Bug 2066619 - The GitCommit of the `oc-mirror version` is not correct
Summary: The GitCommit of the `oc-mirror version` is not correct
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: oc
Version: 4.11
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: 4.11.0
Assignee: Alex
QA Contact: zhou ying
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-03-22 07:56 UTC by zhou ying
Modified: 2022-08-10 10:55 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-08-10 10:55:17 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift oc-mirror pull 407 0 None open Bug 2066619: Cleanup/build machinery dep update 2022-04-13 15:16:08 UTC
Red Hat Product Errata RHSA-2022:5069 0 None None None 2022-08-10 10:55:55 UTC

Description zhou ying 2022-03-22 07:56:04 UTC
Description of problem:
The GitCommit of the `oc-mirror version` is not correct, it should come from the git repo.

Version-Release number of selected component (if applicable):
./oc-mirror version 
Client Version: version.Info{Major:"0", Minor:"2", GitVersion:"v0.2.0-alpha.1", GitCommit:"3abb4c3fc71a815e6a3f6a90122ef4d51be67392", GitTreeState:"clean", BuildDate:"2022-03-21T21:07:36Z", GoVersion:"go1.17.5", Compiler:"gc", Platform:"linux/amd64"}


How reproducible:
always

Steps to Reproduce:
1. Extract the oc-mirror from ocp payload:
RELEASE_IMAGE='registry.ci.openshift.org/ocp/release:4.11.0-0.nightly-2022-03-22-021803'

oc image extract $(oc adm release info $RELEASE_IMAGE  -o=json | jq -r '.references.spec.tags[] | select(.name=="oc-mirror") | .from.name') --path=/usr/bin/oc-mirror:.

2. Check the oc-mirror version information:
Chmod +x oc-mirror; oc-mirror version 

3. Download the latest code for the oc-mirror
4. Compare the GitCommit with the code repo log


Actual results:
2. Show the oc-mirror info as:
./oc-mirror version 
Client Version: version.Info{Major:"0", Minor:"2", GitVersion:"v0.2.0-alpha.1", GitCommit:"3abb4c3fc71a815e6a3f6a90122ef4d51be67392", GitTreeState:"clean", BuildDate:"2022-03-21T21:07:36Z", GoVersion:"go1.17.5", Compiler:"gc", Platform:"linux/amd64"}

4. Can’t find the same commit id for the GitCommit of the oc-mirror version .
[root@localhost oc-mirror]# git log |grep 3abb4c3fc71a815e6a3f6a90122ef4d51be67392


Expected results:
4. The GitCommit is important information for the version  and it should be a real commit id in the code repository. 


Additional info:
we always could find the commit id for the oc :

oc version --client -o yaml 
clientVersion:
  buildDate: "2022-03-21T14:22:50Z"
  compiler: gc
  gitCommit: e9566ccd9ac83809a304ff0f0af9103749342e42
  gitTreeState: clean
  gitVersion: 4.11.0-202203211330.p0.ge9566cc.assembly.stream-e9566cc
  goVersion: go1.17.5
  major: ""
  minor: ""
  platform: linux/amd64


[root@localhost oc]# git log |grep e9566ccd9ac83809a304ff0f0af9103749342e42
commit e9566ccd9ac83809a304ff0f0af9103749342e42

Comment 2 zhou ying 2022-04-19 07:48:18 UTC
Checked with latest payload , the issue has fixed:

RELEASE_IMAGE='registry.ci.openshift.org/ocp/release:4.11.0-0.nightly-2022-04-18-091618'

oc image extract --confirm $(oc adm release info $RELEASE_IMAGE  -o=json | jq -r '.references.spec.tags[] | select(.name=="oc-mirror") | .from.name') --path=/usr/bin/oc-mirror:. 

./oc-mirror version
Client Version: version.Info{Major:"", Minor:"", GitVersion:"4.11.0-202204132228.p0.g1f3f725.assembly.stream-1f3f725", GitCommit:"1f3f72569ac31ee4bacde46f156a31618b752b9e", GitTreeState:"clean", BuildDate:"2022-04-13T22:49:42Z", GoVersion:"go1.17.5", Compiler:"gc", Platform:"linux/amd64"}


check the commit id from oc-mirror repo, could see the id now :

[root@localhost oc-mirror]# git log |grep 1f3f72569ac31ee4bacde46f156a31618b752b9e
commit 1f3f72569ac31ee4bacde46f156a31618b752b9e

Comment 4 errata-xmlrpc 2022-08-10 10:55:17 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 (Important: OpenShift Container Platform 4.11.0 bug fix and security update), 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/RHSA-2022:5069


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