Bug 1827738 - OPM does not have a way to track version/commitId
Summary: OPM does not have a way to track version/commitId
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: OLM
Version: 4.5
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
: 4.5.0
Assignee: Daniel Sover
QA Contact: Bruno Andrade
Depends On:
TreeView+ depends on / blocked
Reported: 2020-04-24 16:46 UTC by Bruno Andrade
Modified: 2020-07-13 17:31 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2020-07-13 17:31:30 UTC
Target Upstream Version:

Attachments (Terms of Use)

System ID Private Priority Status Summary Last Updated
Github operator-framework operator-registry pull 306 0 None closed Bug 1827738: feat(opm): add version command 2020-07-02 04:13:40 UTC
Github operator-framework operator-registry pull 321 0 None closed Bug 1827738: add build flags to opm to show version information 2020-07-02 04:13:40 UTC
Red Hat Product Errata RHBA-2020:2409 0 None None None 2020-07-13 17:31:47 UTC

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

  opm [command]

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

  -h, --help   help for opm

Version-Release number of selected component (if applicable):
commit 2bdcd07e6f9ea23a35f1fdbb6a7c6584ec53a0a1

How reproducible:

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

$ git clone git@github.com:operator-framework/operator-registry.git
$ cd operator-registry/
$ git rev-parse --short HEAD
$ 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.


Note You need to log in before you can comment on or make changes to this bug.