-
Notifications
You must be signed in to change notification settings - Fork 40k
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
handle GOTOOLCHAIN in kube::golang::verify_go_version #120279
Conversation
/sig release Open question: Originally I implemented this to only treat Other than that debatable detail, I think this PR makes sense as a starting point to ensure no surprises when we go to switch to 1.21+ EDIT: In both cases FORCE_HOST_GO=y is still supported as well, I think we clearly need to keep that for the immediate future and it looks straightforward. |
/kind cleanup |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this makes sense, maybe wait for the go1.21 bump PR to merge first (#118996)?
fc5bc62
to
682026f
Compare
682026f
to
3231267
Compare
f25c93a
to
dce07fe
Compare
for now: - shim FORCE_HOST_GO to GOTOOLCHAIN=local - treat GOTOOLCHAIN set and !=auto like FORCE_HOST_GO - otherwise set GOTOOLCHAIN=go${GO_VERSION} and fallback to gimme if necessary TODO: set toolchain statements in go.mod files and keep them in sync
dce07fe
to
d1b5a99
Compare
/retest This was rewritten to:
Someday we can drop 3b), and we already won't wind up running it if the host has 1.21+ |
/lgtm |
LGTM label has been added. Git tree hash: e6deacbfa505624746c2367fd40b2540460ade4b
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: BenTheElder, liggitt The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Pretty confident this has reasonable behavior now. I think somewhere in N+M releases we should revisit:
But this should be a reasonable starting point. |
/hold cancel |
/retest |
GOTOOLCHAIN="go${GO_VERSION}" | ||
export GOTOOLCHAIN |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should move inside the if block where we don't have the go version we want... I'm seeing behavior where setting GOTOOLCHAIN=go1.21.1
explicitly is making go1.21.1
try to redownload (maybe related to build modifiers like boringcrypto being enabled)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd expect short of a go bug (maybe in goboring), that GOTOOLCHAIN == current version should not result in downloading go again, but if GOTOOLCHAIN != current version.
The intention is setting it here should ensure that go version wasn't selected e.g. because this script was invoked with pwd=sigs.k8s.io/kind and it read that go.mod or other ways that GOTOOLCHAIN gets auto-selected. Setting GOTOOLCHAIN even if go version
gives the desired version at this early invocation should force consistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
go env GOVERSION
reports go1.21.1 X:boringcrypto
when boringcrypto is enabled. The go version
check we're doing below ignores any experiments, so when we force GOTOOLCHAIN to exactly go1.21.1
, we might be creating the mismatch.
Worth filing an issue for the go team to clarify how we should be using GOTOOLCHAIN in a situation like this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK, I suspect export GOTOOLCHAIN=local
is the right answer when using a toolchain like this.
If not I think we could add a check for X:
experiments early in the version check and assume that we should behave like GOTOOLCHAIN=local
if an experimental toolchain is being used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK, I suspect export GOTOOLCHAIN=local is the right answer when using a toolchain like this
I don't think so ... GOTOOLCHAIN=local
won't do the right thing when we propagate into a build container with a different go version (like our kube-cross images)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[we've reached out for clarification with the go team and will follow-up...]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
forgot to circle back here -- The expectation is that users will use GOEXPERIMENT which works with GOTOOLCHAIN (and this PR), GOTOOLCHAIN will download the standard toolchain but you can use the standard toolchain with GOEXPERIMENT instead of a modified toolchain, and that issue generally exists for 1.21+ in all projects.
Cherry pick handle #120279 GOTOOLCHAIN in kube::golang::verify_go_version onto 1.27
Cherry pick handle #120279 GOTOOLCHAIN in kube::golang::verify_go_version onto 1.26
Cherry pick handle #120279 GOTOOLCHAIN in kube::golang::verify_go_version onto 1.28
for now:
TODO (future PR): set toolchain statements in go.mod files and keep them in sync?
What type of PR is this?
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
https://go.dev/doc/toolchain#GOTOOLCHAIN
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:
Holding for further discussion
/hold