Bug 1832769

Summary: [kubevirt version] is not reported correctly
Product: Container Native Virtualization (CNV) Reporter: Tareq Alayan <talayan>
Component: VirtualizationAssignee: Daniel Belenky <dbelenky>
Status: CLOSED ERRATA QA Contact: zhe peng <zpeng>
Severity: high Docs Contact:
Priority: high    
Version: 2.4.0CC: cnv-qe-bugs, ncredi, sgott
Target Milestone: ---   
Target Release: 2.4.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: hco-bundle-registry-container-v2.3.0-299 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-07-28 19:10:05 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:
Attachments:
Description Flags
disable GO111MODULE during the build none

Description Tareq Alayan 2020-05-07 09:25:30 UTC
Description of problem:
kubevirt doesn't report its git commit or version

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


How reproducible:
always

Steps to Reproduce:
kubectl proxy >/dev/null &
curl -sS http://127.0.0.1:8001/apis/subresources.kubevirt.io
{
  "kind": "APIGroup",
  "apiVersion": "v1",
  "name": "subresources.kubevirt.io",
  "versions": [
    {
      "groupVersion": "subresources.kubevirt.io/v1alpha3",
      "version": "v1alpha3"
    }
  ],
  "preferredVersion": {
    "groupVersion": "subresources.kubevirt.io/v1alpha3",
    "version": "v1alpha3"
  }
}

we take the version v1alpha3
and then:
curl -sS http://127.0.0.1:8001/apis/subresources.kubevirt.io/v1alpha3/version
{
 "gitVersion": "v0.0.0-master+$Format:%h$",
 "gitCommit": "$Format:%H$",
 "gitTreeState": "",
 "buildDate": "1970-01-01T00:00:00Z",
 "goVersion": "go1.13.4",
 "compiler": "gc",
 "platform": "linux/amd64"
}
fg
ctrl-c


Expected results:

{
 "gitVersion": "v0.26.1",
 "gitCommit": "e40ff7965e2aadbf21131626dfa3be85524e3a2c",
 "gitTreeState": "clean",
 "buildDate": "2020-03-31T16:26:36Z",
 "goVersion": "go1.12.12",
 "compiler": "gc",
 "platform": "linux/amd64"
}



Additional info:

Comment 1 Tareq Alayan 2020-05-07 09:26:45 UTC
(In reply to Tareq Alayan from comment #0)
> Description of problem:
> kubevirt doesn't report its git commit or version
> 
> Version-Release number of selected component (if applicable):
 HCO image: registry-proxy.engineering.redhat.com/rh-osbs/container-native-virtualization-hyperconverged-cluster-operator@sha256:79b15a603fe6527df83dd53033410bedc54bb19c22f7853f770fbbf62008f024
CSV creation time: 2020-05-06 21:08:08
> 
> 
> How reproducible:
> always
> 
> Steps to Reproduce:
> kubectl proxy >/dev/null &
> curl -sS http://127.0.0.1:8001/apis/subresources.kubevirt.io
> {
>   "kind": "APIGroup",
>   "apiVersion": "v1",
>   "name": "subresources.kubevirt.io",
>   "versions": [
>     {
>       "groupVersion": "subresources.kubevirt.io/v1alpha3",
>       "version": "v1alpha3"
>     }
>   ],
>   "preferredVersion": {
>     "groupVersion": "subresources.kubevirt.io/v1alpha3",
>     "version": "v1alpha3"
>   }
> }
> 
> we take the version v1alpha3
> and then:
> curl -sS http://127.0.0.1:8001/apis/subresources.kubevirt.io/v1alpha3/version
> {
>  "gitVersion": "v0.0.0-master+$Format:%h$",
>  "gitCommit": "$Format:%H$",
>  "gitTreeState": "",
>  "buildDate": "1970-01-01T00:00:00Z",
>  "goVersion": "go1.13.4",
>  "compiler": "gc",
>  "platform": "linux/amd64"
> }
> fg
> ctrl-c
> 
> 
> Expected results:
> 
> {
>  "gitVersion": "v0.26.1",
>  "gitCommit": "e40ff7965e2aadbf21131626dfa3be85524e3a2c",
>  "gitTreeState": "clean",
>  "buildDate": "2020-03-31T16:26:36Z",
>  "goVersion": "go1.12.12",
>  "compiler": "gc",
>  "platform": "linux/amd64"
> }
> 
> 
> 
> Additional info:

Comment 2 Daniel Belenky 2020-05-21 13:13:00 UTC
The root cause for this bug is that we are now using Go 1.13
and it uses go modules to for to compile the sources unless
we explicitly set GO111MODULE to 'off'.

A fix that disables GO111MODULE:
https://code.engineering.redhat.com/gerrit/#/c/201060/1

Currently there is an outage in Brew so we can't get new builds.

Comment 3 Daniel Belenky 2020-05-21 13:14:17 UTC
Created attachment 1690641 [details]
disable GO111MODULE during the build

Comment 4 Daniel Belenky 2020-05-21 14:25:46 UTC
Verified that with a scratch build we get the values as expected:

[root@7b05b5f26f48 /]# virtctl version
Client Version: version.Info{GitVersion:"v0.29.1", GitCommit:"3452204c267b9c29492e2afc3c18761ee42a17e6", GitTreeState:"clean", BuildDate:"2020-05-21T13:20:50Z", GoVersion:"go1.13.4", Compiler:"gc", Platform:"linux/amd64"}


I merged the patch, let's wait for official build and verification from QE.
Moving the bug to MODIFIED.

Comment 5 zhe peng 2020-06-15 03:04:47 UTC
verify with build:
$ virtctl version
Client Version: version.Info{GitVersion:"v0.26.1", GitCommit:"e40ff7965e2aadbf21131626dfa3be85524e3a2c", GitTreeState:"clean", BuildDate:"2020-02-19T16:13:09Z", GoVersion:"go1.11.5", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{GitVersion:"v0.30.0", GitCommit:"736b4aec6b2e92f2ab09ccfa6c5eb79366e88e5a", GitTreeState:"clean", BuildDate:"2020-06-08T21:28:27Z", GoVersion:"go1.13.4", Compiler:"gc", Platform:"linux/amd64"}

sh-4.2# kubectl proxy >/dev/null & curl -sS http://127.0.0.1:8001/apis/subresources.kubevirt.io
[2] 2066654
{
  "kind": "APIGroup",
  "apiVersion": "v1",
  "name": "subresources.kubevirt.io",
  "versions": [
    {
      "groupVersion": "subresources.kubevirt.io/v1alpha3",
      "version": "v1alpha3"
    }
  ],
  "preferredVersion": {
    "groupVersion": "subresources.kubevirt.io/v1alpha3",
    "version": "v1alpha3"
  }
}

sh-4.2# curl -sS http://127.0.0.1:8001/apis/subresources.kubevirt.io/v1alpha3/version
{
 "gitVersion": "v0.30.0",
 "gitCommit": "736b4aec6b2e92f2ab09ccfa6c5eb79366e88e5a",
 "gitTreeState": "clean",
 "buildDate": "2020-06-08T21:28:27Z",
 "goVersion": "go1.13.4",
 "compiler": "gc",
 "platform": "linux/amd64"
}

move to verified.

Comment 8 errata-xmlrpc 2020-07-28 19:10:05 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/RHSA-2020:3194