Bug 1835704

Summary: [mac][win] No cluster version info in the gitVersion of the Mac `oc` client
Product: OpenShift Container Platform Reporter: Jian Zhang <jiazha>
Component: ocAssignee: Sally <somalley>
Status: CLOSED ERRATA QA Contact: zhou ying <yinzhou>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.5CC: aos-bugs, jokerman, mfojtik
Target Milestone: ---Keywords: Reopened
Target Release: 4.6.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-10-27 15:59:18 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 Jian Zhang 2020-05-14 10:48:58 UTC
Description of problem:
The info of the gitVersion is wrong.

mac:oc_client jianzhang$ ./oc version -o yaml
clientVersion:
  buildDate: "2020-05-12T17:23:58Z"
  compiler: gc
  gitCommit: ea28b2c4e1f985c62aced8a1e413f571d37afe54
  gitTreeState: dirty
  gitVersion: ea28b2c4e
  goVersion: go1.13.4
  major: ""
  minor: ""
  platform: darwin/amd64
releaseClientVersion: 4.5.0-0.nightly-2020-05-12-224129


Version-Release number of selected component (if applicable):
4.5

How reproducible:
always

Steps to Reproduce:
1. Get the Mac `oc` client from the https://openshift-release-artifacts.svc.ci.openshift.org/4.5.0-0.nightly-2020-05-12-224129/

2. Run the `oc version -o yaml`


Actual results:

mac:oc_client jianzhang$ ./oc version -o yaml
clientVersion:
  buildDate: "2020-05-12T17:23:58Z"
  compiler: gc
  gitCommit: ea28b2c4e1f985c62aced8a1e413f571d37afe54
  gitTreeState: dirty
  gitVersion: ea28b2c4e
  goVersion: go1.13.4
  major: ""
  minor: ""
  platform: darwin/amd64
releaseClientVersion: 4.5.0-0.nightly-2020-05-12-224129


Expected results:
The gitVersion should contain the cluster version info, as the Linux `oc` does. As follows: 
[root@preserve-olm-env data]# ./oc version -o yaml
clientVersion:
  buildDate: "2020-05-12T17:11:09Z"
  compiler: gc
  gitCommit: ea28b2c4e1f985c62aced8a1e413f571d37afe54
  gitTreeState: dirty
  gitVersion: openshift-clients-4.5.0-202005121637
  goVersion: go1.13.4
  major: ""
  minor: ""
  platform: linux/amd64
openshiftVersion: 4.5.0-0.nightly-2020-05-13-221558

Additional info:
The Linux `oc` client.

[root@preserve-olm-env data]# ./oc version -o yaml
clientVersion:
  buildDate: "2020-05-12T17:11:09Z"
  compiler: gc
  gitCommit: ea28b2c4e1f985c62aced8a1e413f571d37afe54
  gitTreeState: dirty
  gitVersion: openshift-clients-4.5.0-202005121637
  goVersion: go1.13.4
  major: ""
  minor: ""
  platform: linux/amd64
openshiftVersion: 4.5.0-0.nightly-2020-05-13-221558

Comment 1 Maciej Szulik 2020-05-14 11:36:53 UTC
The difference between openShiftVersion and releaseClientVersion is these are two separate fields.
The latter is set for every client, it's coming from actual version of the binary.
The former is coming from the server, but you need to be system:admin or any other user capable of reading ClusterOperators
to be able to see this. I'm closing this as not a bug, if you want to re-open please double check the 
output with -v=9 and check if your user can properly see the cluster operator version.

Comment 2 zhou ying 2020-05-28 03:00:04 UTC
@Maciej Szulik :

There are two little issue for the clientVersion:
1) 'gitTreeState: dirty' shouldn't be dirty, should be clean;
2) 'gitVersion: ea28b2c4e' shouldn't only the git commit id, should be like this: gitVersion: 4.5.0-202005271737-06cc74b

So I'll reopen it. 

oc client on windows also has the same issue:
$ ./oc version -o yaml 
clientVersion:
  buildDate: "2020-05-26T21:24:07Z"
  compiler: gc
  gitCommit: 384535d084fda4ab8b3e37c995bf20ed46dbce51
  gitTreeState: dirty
  gitVersion: 384535d0
  goVersion: go1.13.4
  major: ""
  minor: ""
  platform: windows/amd64


But oc on linux is ok:
[root@dhcp-140-138 ~]# oc version --client -o yaml
clientVersion:
  buildDate: "2020-05-27T17:43:48Z"
  compiler: gc
  gitCommit: 06cc74b10770e609b99c0be95284331c94b14d85
  gitTreeState: clean
  gitVersion: 4.5.0-202005271737-06cc74b
  goVersion: go1.13.4
  major: ""
  minor: ""
  platform: linux/amd64

Comment 3 Maciej Szulik 2020-05-28 07:54:40 UTC
Sally can you check this one out, I don't have any win nor mac machines around :/

Comment 4 Sally 2020-06-10 18:23:47 UTC
I confirmed on Windows10 with oc downloaded from https://mirror.openshift.com/pub/openshift-v4/clients/  
All looks ok to me.  Moving to modified, for QA to retry.  Thanks. 

$ cat ~/Documents/oc-4.4-version-win-output 
  clientVersion:
  buildDate: "2020-05-29T06:45:40Z"
  compiler: gc
  gitCommit: 1960dd73b123241730531db09489d951228ad853
  gitTreeState: clean
  gitVersion: 4.4.0-202005290638-1960dd7
  goVersion: go1.13.4
  major: ""
  minor: ""
  platform: windows/amd64

$ cat ~/Documents/oc-4.5-version-win-output 
  clientVersion:
  buildDate: "2020-05-29T14:26:33Z"
  compiler: gc
  gitCommit: 9933eb90790b36d153fcc55f8404724bb0929b96
  gitTreeState: clean
  gitVersion: 4.5.0-202005291417-9933eb9
  goVersion: go1.13.4
  major: ""
  minor: ""
  platform: windows/amd64

Comment 7 zhou ying 2020-06-15 03:09:50 UTC
Zhous-MacBook-Pro:~ zhouying$ ./oc version -o yaml 
clientVersion:
  buildDate: "2020-06-09T22:58:28Z"
  compiler: gc
  gitCommit: f30826ef04e45eea1745276dee8e693a08e29dba
  gitTreeState: dirty
  gitVersion: openshift-clients-4.6.0-202006092217
  goVersion: go1.13.4
  major: ""
  minor: ""
  platform: darwin/amd64


$ ./oc.exe version -o yaml 
clientVersion:
  buildDate: "2020-06-09T22:58:59Z"
  compiler: gc
  gitCommit: f30826ef04e45eea1745276dee8e693a08e29dba
  gitTreeState: dirty
  gitVersion: openshift-clients-4.6.0-202006092217
  goVersion: go1.13.4
  major: ""
  minor: ""
  platform: windows/amd64

Comment 9 errata-xmlrpc 2020-10-27 15:59:18 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 (OpenShift Container Platform 4.6 GA Images), 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:4196