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

Include Go version, platform, and other build info in version string #19905

Merged
merged 1 commit into from
Mar 14, 2016

Conversation

ixdy
Copy link
Member

@ixdy ixdy commented Jan 21, 2016

Tracking down the root cause of #17524 probably would've been easier if we'd more readily exposed the Go version used to build Kubernetes, so this PR adds it to the version string exported.

This is fairly similar to the build information contained in Linux's version string or the command docker version.

Note that this will make MatchesServerVersion fail if the client/server were built at the same git hash but with a different version of Go. I'm not sure if this is something to worry about.

I don't think this is likely to break anything, but I'm not entirely confident on that.

(I also considered whether we want to add a build timestamp, like Linux and Docker have, but then we'd definitely want to ignore it in MatchesServerVersion, so I left that out for now.)

@k8s-github-robot
Copy link

Labelling this PR as size/S

@k8s-github-robot k8s-github-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jan 21, 2016
@k8s-bot
Copy link

k8s-bot commented Jan 21, 2016

GCE e2e build/test failed for commit 20032d42acbc11c50e323581fae2a996ee0ab943.

@ixdy ixdy force-pushed the export-go-version branch from 20032d4 to 95c3004 Compare January 21, 2016 03:46
@k8s-bot
Copy link

k8s-bot commented Jan 21, 2016

GCE e2e build/test failed for commit 95c3004b3c17ac45162e26c738aff45251b15906.

@k8s-bot
Copy link

k8s-bot commented Jan 21, 2016

GCE e2e test build/test passed for commit 95c3004b3c17ac45162e26c738aff45251b15906.

@luxas
Copy link
Member

luxas commented Mar 2, 2016

Will this make v1.2?

@ixdy
Copy link
Member Author

ixdy commented Mar 2, 2016

@luxas it's been unclear to me if anyone wants it...

@ixdy
Copy link
Member Author

ixdy commented Mar 2, 2016

@k8s-bot test this please, issue #IGNORE (Jenkins got stuck at some point?)

@bgrant0607
Copy link
Member

@lavalamp @liggitt @deads2k Can any of you think of a problem this would cause? It seems like the git hashes would mismatch any time the go versions differed.

@liggitt
Copy link
Member

liggitt commented Mar 2, 2016

wouldn't kubectl --match-server-version complain about a client built with a different go version than the server? that seems less than ideal

edit: read the description, which called that out. still think that's less than ideal.

@k8s-bot
Copy link

k8s-bot commented Mar 2, 2016

GCE e2e build/test passed for commit 95c3004b3c17ac45162e26c738aff45251b15906.

@deads2k
Copy link
Contributor

deads2k commented Mar 2, 2016

wouldn't kubectl --match-server-version complain about a client built with a different go version than the server? that seems less than ideal

An argument to fix MatchesServerVersion, not one to avoid adding this information. It's a little esoteric, but as long as MatchesServerVersion is updated to skip trying to match on go compiler level I don't see it as a problem.

@smarterclayton
Copy link
Contributor

smarterclayton commented Mar 2, 2016 via email

@liggitt
Copy link
Member

liggitt commented Mar 2, 2016

Fortunately matchesServerVersion doesn't have to be backwards compatible

heh, true

@lavalamp
Copy link
Member

lavalamp commented Mar 2, 2016

I think the go version skew between client & server is a) hard to get in practice b) worth noting when it happens. So I think this is probably net good. LGTM

@ixdy
Copy link
Member Author

ixdy commented Mar 3, 2016

So what's the consensus here? Do we want to update MatchesServerVersion to ignore the go version? Or is this fine as-is?

@ixdy ixdy force-pushed the export-go-version branch 2 times, most recently from 38c25e3 to e53bb95 Compare March 3, 2016 07:30
@deads2k
Copy link
Contributor

deads2k commented Mar 3, 2016

So what's the consensus here? Do we want to update MatchesServerVersion to ignore the go version? Or is this fine as-is?

I'd like to ignore the go version and base the decision on whether server and client were built from the same code.

@lavalamp
Copy link
Member

lavalamp commented Mar 4, 2016

I vote for it being fine as-is. I think client & server built with
different versions of go should be considered different. The only way you
can convince me otherwise is if cross-platform client/server combos would
trip over this.

On Thu, Mar 3, 2016 at 5:01 AM, David Eads notifications@github.com wrote:

So what's the consensus here? Do we want to update MatchesServerVersion to
ignore the go version? Or is this fine as-is?

I'd like to ignore the go version and base the decision on whether server
and client were built from the same code.


Reply to this email directly or view it on GitHub
#19905 (comment)
.

@ixdy
Copy link
Member Author

ixdy commented Mar 4, 2016

The way it is is certainly less work for me. :)

Otherwise I will probably need to clear out the client and server Go versions in MatchesServerVersion, since I'd prefer to keep using reflect.DeepEqual instead of enumerating all fields.

(It's also possible there's code elsewhere that compares versions, which would also need to account for Go versions? I can do another pass to see. It's kinda unfortunate that MatchesServerVersion is in pkg/client/unversioned/helper.go instead of pkg/version, where it'd probably be more appropriate, but that's also a more in-depth refactoring effort.)

@lavalamp
Copy link
Member

lavalamp commented Mar 4, 2016

If the platform isn't in the go version then I'm good with it the way it
is. @deads2k why do you think it will be problematic?

On Thu, Mar 3, 2016 at 4:17 PM, Jeff Grafton notifications@github.com
wrote:

The way it is is certainly less work for me. :)

Otherwise I will probably need to clear out the client and server Go
versions in MatchesServerVersion, since I'd prefer to keep using
reflect.DeepEqual instead of enumerating all fields.

(It's also possible there's code elsewhere that compares versions, which
would also need to account for Go versions? I can do another pass to see.
It's kinda unfortunate that MatchesServerVersion is in
pkg/client/unversioned/helper.go instead of pkg/version, where it'd
probably be more appropriate, but that's also a more in-depth refactoring
effort.)


Reply to this email directly or view it on GitHub
#19905 (comment)
.

@ixdy
Copy link
Member Author

ixdy commented Mar 4, 2016

@lavalamp what the version looks like now (from the most recent e2e run of this PR):

2016/01/21 20:13:42 e2e.go:303: Running: 'kubectl version --match-server-version=false'
Client Version: version.Info{Major:"1", Minor:"2+", GitVersion:"v1.2.0-alpha.6.361+832d81820d7497", GitCommit:"832d81820d749749409495d7536274ee76e706ce", GitTreeState:"clean", GoVersion:"go1.4.2"}
Server Version: version.Info{Major:"1", Minor:"2+", GitVersion:"v1.2.0-alpha.6.361+832d81820d7497", GitCommit:"832d81820d749749409495d7536274ee76e706ce", GitTreeState:"clean", GoVersion:"go1.4.2"}

So no platform info.

@ixdy
Copy link
Member Author

ixdy commented Mar 4, 2016

@k8s-bot test this please, issue #22435

@ixdy ixdy force-pushed the export-go-version branch from 2baff5e to 38e7d9b Compare March 11, 2016 22:35
@ixdy
Copy link
Member Author

ixdy commented Mar 11, 2016

It seems go1.5.3 doesn't like spaces in the ldflag value, so I switched to using the ISO8601 format for the build date.

@k8s-bot
Copy link

k8s-bot commented Mar 11, 2016

GCE e2e build/test passed for commit 2baff5e7e4cf5a3e24b2f302f92fa3864573e229.

@k8s-bot
Copy link

k8s-bot commented Mar 11, 2016

GCE e2e build/test passed for commit 38e7d9bd30bcc789be93f5511c73afd0f61d9cd7.

@luxas
Copy link
Member

luxas commented Mar 14, 2016

@ixdy Please squash and maybe @lavalamp could LGTM so we could get this in.
Will be valuable to have merged

@lavalamp
Copy link
Member

lgtm

@lavalamp
Copy link
Member

apply the label once you squash.

@ixdy ixdy force-pushed the export-go-version branch from 38e7d9b to daf4046 Compare March 14, 2016 20:53
@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for the commit author(s). If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.

@ixdy ixdy force-pushed the export-go-version branch from daf4046 to dda45ab Compare March 14, 2016 20:54
@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for the commit author(s). If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.

Additionally update MatchesServerVersion to only check GitVersion,
GitCommit, and GitTreeState.
@ixdy ixdy force-pushed the export-go-version branch from dda45ab to fb663f2 Compare March 14, 2016 20:55
@ixdy
Copy link
Member Author

ixdy commented Mar 14, 2016

Sorry for the noise. Interactive rebased a bit too far, but fixed now.

Thanks for review.

@ixdy ixdy added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 14, 2016
@k8s-github-robot
Copy link

@k8s-bot ok to test
@k8s-bot test this

pr builder appears to be missing, activating due to 'lgtm' label.

@k8s-bot
Copy link

k8s-bot commented Mar 14, 2016

GCE e2e build/test passed for commit dda45ab030cde5d1a9b3c6c1da1923cf733c2703.

@k8s-bot
Copy link

k8s-bot commented Mar 14, 2016

GCE e2e build/test passed for commit fb663f2.

@k8s-github-robot
Copy link

@k8s-bot test this [submit-queue is verifying that this PR is safe to merge]

@k8s-bot
Copy link

k8s-bot commented Mar 14, 2016

GCE e2e build/test passed for commit fb663f2.

@k8s-github-robot
Copy link

Automatic merge from submit-queue

k8s-github-robot pushed a commit that referenced this pull request Mar 14, 2016
@k8s-github-robot k8s-github-robot merged commit 7d0de5c into kubernetes:master Mar 14, 2016
@ixdy ixdy deleted the export-go-version branch August 13, 2016 00:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.