Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect version values from version.Get() #3

Closed
ffromani opened this issue Jul 26, 2019 · 6 comments
Closed

Incorrect version values from version.Get() #3

ffromani opened this issue Jul 26, 2019 · 6 comments

Comments

@ffromani
Copy link

I vendored client-go v0.19.0 in my project.
I just fetch the version and log it on server startup, and I see something like

{"component":"kubevirt-template-validator","level":"info","msg":"kubevirt-template-validator using kubevirt client-go (v0.0.0-master+$Format:%h$ $Format:%H$ 1970-01-01T00:00:00Z)","pos":"app.go:77","timestamp":"2019-07-26T13:21:30.760879Z"}

I was expecting

  • GitVersion [v]0.19.0
  • GitCommit
  • BuildDate a valid date

it seems these fields aren't properly set when the tag is cut.

@slintes
Copy link

slintes commented Jul 29, 2019

How did you get that version? I assume with the version pkg? Well, it works as designed: the version package was designed to report the KubeVirt version, and values are set during the build process via ldflags. The values you see are the default values.
So even when you update your build process to set those values, it would report the version of your own component, and not client-go's version. Not sure if we can/want to support the latter. @rmohr wdyt?

You can get KubeVirt's server version if that helps:

virtClient, _ := kubecli.GetKubevirtClient()
info, _ := virtClient.ServerVersion().Get()

@rmohr
Copy link
Member

rmohr commented Jul 29, 2019

Not sure if we can/want to support the latter.

Yep I don't think it makes much sense to support this.

@slintes can we exclude anything related to version from client-go, when we sync with staging?

@slintes
Copy link

slintes commented Jul 29, 2019

can we exclude anything related to version from client-go, when we sync with staging?

I think just excluding something won't work (well, it wouldn't be nice at least imho). But we could refactor it to only keep the version.Info struct in client-go (it's used in kubecli for getting the server's version), and move everything else back to kubevirt.

@ffromani
Copy link
Author

@slintes yep, you basically got it. Looks like I misunderstood the purpose of the version package in the client-go module.
I'd like a way to report (= print in the logs) the release of client-go which my binary has compiled in; I can think of few workarounds which don't require any change, so we can close this issue.

@slintes
Copy link

slintes commented Jul 29, 2019

if you have a workaround which we could easily add to client-go, let us know 🙂

/close

@kubevirt-bot
Copy link
Contributor

@slintes: Closing this issue.

In response to this:

if you have a workaround which we could easily add to client-go, let us know 🙂

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants