Bug 1827738

Summary: OPM does not have a way to track version/commitId
Product: OpenShift Container Platform Reporter: Bruno Andrade <bandrade>
Component: OLMAssignee: Daniel Sover <dsover>
OLM sub component: OLM QA Contact: Bruno Andrade <bandrade>
Status: CLOSED ERRATA Docs Contact:
Severity: low    
Priority: low CC: dsover, ecordell, jiazha, kuiwang
Version: 4.5   
Target Milestone: ---   
Target Release: 4.5.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-07-13 17:31:30 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Bruno Andrade 2020-04-24 16:46:55 UTC
Description of problem:

OPM does not have a way to get the compiled commitId or version. That could help correlate issues with a specific version.

opm -h                                                                                      1 ↵
CLI to interact with operator-registry and build indexes of operator content

Usage:
  opm [command]

Available Commands:
  help        Help about any command
  index       generate operator index container images
  registry    interact with operator-registry database

Flags:
  -h, --help   help for opm



Version-Release number of selected component (if applicable):
https://github.com/operator-framework/operator-registry
commit 2bdcd07e6f9ea23a35f1fdbb6a7c6584ec53a0a1

How reproducible:
Always


Actual results:
OPM does not have a way to track version

Expected results:
Have a way to get commitId with the binary

Additional info:

Comment 9 Bruno Andrade 2020-05-14 14:56:32 UTC
Now the Makefile has the proper flags. LGTM, thanks.

git rev-parse --short HEAD
9994e3e

$ git clone git:operator-framework/operator-registry.git
$ cd operator-registry/
$ git rev-parse --short HEAD
9994e3e
$ make build
GOFLAGS="-mod=vendor" go build  -o bin/appregistry-server ./cmd/appregistry-server
GOFLAGS="-mod=vendor" go build  -o bin/configmap-server ./cmd/configmap-server
GOFLAGS="-mod=vendor" go build  -o bin/initializer ./cmd/initializer
GOFLAGS="-mod=vendor" go build  -o bin/registry-server ./cmd/registry-server
GOFLAGS="-mod=vendor" go build -ldflags "-X 'github.com/operator-framework/operator-registry/cmd/opm/version.gitCommit=9994e3e' -X 'github.com/operator-framework/operator-registry/cmd/opm/version.opmVersion=1.12.3' -X 'github.com/operator-framework/operator-registry/cmd/opm/version.buildDate=2020-05-14T14:39:40Z'"  -o bin/opm ./cmd/opm
$ ./bin/opm version
Version: version.Version{OpmVersion:"1.12.3", GitCommit:"9994e3e", BuildDate:"2020-05-14T14:39:40Z", GoOs:"linux", GoArch:"amd64"}

Comment 10 errata-xmlrpc 2020-07-13 17:31:30 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:2409