Bug 1793267

Summary: [RPM-packed oc ] `oc version -o yaml` does not show the oc detailed version information, blocking QE 4.4 auto test
Product: OpenShift Container Platform Reporter: zhou ying <yinzhou>
Component: ocAssignee: Maciej Szulik <maszulik>
Status: CLOSED CURRENTRELEASE QA Contact: zhou ying <yinzhou>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 4.4CC: aos-bugs, jokerman, lmeyer, lxia, maszulik, mfojtik, shiywang, vlaad, xtian, xxia, yuxzhu
Target Milestone: ---Keywords: Regression, Reopened, TestBlocker
Target Release: 4.4.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: Internal build components has moved places. Consequence: oc version wasn't outputting proper version information. Fix: Update internal build components with the new paths. Result: oc version is providing correct information about its version.
Story Points: ---
Clone Of: 1788357 Environment:
Last Closed: 2020-02-12 06:45:08 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1788357    
Bug Blocks:    

Comment 1 zhou ying 2020-01-21 03:20:51 UTC
oc installed by RPM-packed still has this issue:

[root@dhcp-140-138 ~]# oc version -o yaml 
clientVersion:
  buildDate: ""
  compiler: gc
  gitCommit: ""
  gitTreeState: ""
  gitVersion: unknown
  goVersion: go1.13.4
  major: ""
  minor: ""
  platform: linux/amd64
....

[root@dhcp-140-138 ~]# rpm -q openshift-clients
openshift-clients-4.4.0-202001170700.git.1.35f9dad.el7.x86_64

Comment 2 Xingxing Xia 2020-01-22 03:33:52 UTC
Shiyang, Yuxiang, Luke and Vikas,
  Since QE's auto test slaves extract latest oc automatically from latest above RPM, retrieve client version from that oc to run tests for the versioned cases, now QE's 4.4 auto test failed and is blocked due to this bug.
  So adding this needinfo request to you, please help address it by making the oc in above RPM include the fix of bug 1788357 ASAP.
  Thank you in advance.

Comment 3 Yuxiang Zhu 2020-01-22 08:35:47 UTC
@lmeyer has created tag https://github.com/openshift/oc/tree/openshift-clients-4.4. Succeeding builds should have correct version.

Comment 6 Maciej Szulik 2020-01-28 12:20:39 UTC
In https://github.com/openshift/oc/pull/250 we fixed the ld flags injected into the command, I have a PR also for 4.3 fixing the same issue. 
All the data are read from current git, this includes the gitVersion, gitCommit and gitTreeState. If those cannot be read properly from 
repository then can be injected into build system through these 3 variables: SOURCE_GIT_TAG, SOURCE_GIT_COMMIT, SOURCE_GIT_TREE_STATE.

I hope the above will help unstick ART.

Comment 9 Maciej Szulik 2020-02-05 08:34:46 UTC
Not there yet, still missing one final PR.

Comment 11 zhou ying 2020-02-06 01:28:23 UTC
Confirmed with latest oc clients, the issue still can reproduce:
[root@dhcp-140-138 ~]# rpm -q openshift-clients
openshift-clients-4.4.0-202002052231.git.1.3433f68.el7.x86_64

[root@dhcp-140-138 ~]# oc version -o yaml
clientVersion:
  buildDate: ""
  compiler: gc
  gitCommit: ""
  gitTreeState: ""
  gitVersion: unknown
  goVersion: go1.13.4
  major: ""
  minor: ""
  platform: linux/amd64

Comment 12 Maciej Szulik 2020-02-10 11:23:13 UTC
This was merged into oc on Feb 6th, so the build with a fix must be older than Feb 7th, at least. Moving back to modified.

Comment 14 zhou ying 2020-02-11 01:39:48 UTC
The issue has fixed:
[root@localhost ~]# oc version -o yaml 
clientVersion:
  buildDate: "2020-02-10T17:21:47Z"
  compiler: gc
  gitCommit: ee05f83cb8f0bee84c0a1516591437cd71befdc8
  gitTreeState: clean
  gitVersion: v4.4.0
  goVersion: go1.13.4
  major: ""
  minor: ""
  platform: linux/amd64

Comment 15 Yuxiang Zhu 2020-02-18 02:33:24 UTC
Fixed in latest releases.