-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
ci: fix GHA CI build matrix #4436
Conversation
d13691a
to
b534cd1
Compare
Ah, yes, these are the fun ones. I think this is caused by #4347, which switched to the SemVer format, which forces it to download the version. I've tried to avoid using that format, but not sure how much longer Go allows the old format to be used. Honestly, I think that the |
go.mod
Outdated
go 1.22.0 | ||
go 1.21.0 |
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.
Does it still allow the version to be specified without .0
? That would also avoid some of this.
More fun facts; it's likely that this also downgrades language version; i.e. even if you have a (say) _go1.22.go
file to provide compatibility for multiple go versions, Go may now ignore those, and just fail to compile "must use goXXX". See opencontainers/runc#4277 (comment)
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.
it's likely that this also downgrades language version
I think that's what we want, right? If we want b/w compatibility with one minor version back we should make sure we don't use the language features that are incompatible with those
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.
Yeah, so the weird thing there was that, it's not even possible to produce support for both through common mechanisms; i.e., talking about constructs like;
foo_go1.21.go
//go:build !go1.22
// implementation for go < 1.22
foo_current.go
//go:build go1.22
// implementation for go >= 1.22
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.
If we mark go.mod
with the minimum supported Go version and force the compilation using that very version as this PR attempts to do I am pretty happy with that outcome.
.github/workflows/build.yml
Outdated
env: | ||
# Setting GOTOOLCHAIN to local tells go | ||
# to to use the bundled Go version rather | ||
# than fetching the tolchain according to |
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.
Typo; tolchain
What's with the new certs in the vendor folder? Is that really an artifact of the go toolchain change? |
I am not entirely sure. The certs were added as part of running I had a look at the dependency repo ( Our deps are pinned to Line 63 in 0e85089
So it's a bit strange. My theory at the time was there is a difference in how different toolchain versions handle dependency vendoring (i.e. Now, I'm thinking we should bump the Go version in the |
Yes, I think newer versions more aggressively pruning files from vendor. It already excluded testdata directories elsewhere, and for these ones already removed the |
I think we should bump it back to 1.22 🤷♂️ WDYT @Jamstah |
We can specify the Go version in the go.mod file and split the matrix into two jobs: one that uses the version defined in go.mod and another that uses the local version. |
Isnt that what this PR is actually doing? Am I missing something? |
It would appear that requesting Go 1.21 in the build matrix has no effect whatsoever on what go toolchain is actually used to build the project. Specifying 1.22.0 in the go.mod go directive forces the 1.22 toolchain to be used for building Go source files, ignoring whatever Go version we set in the GHA CI matrix. Luckily we can enforce the right setting by setting GOTOOLCHAIN=local which forces Go to use the locally available toolchain instead of downloading the one requested by go.mod. Signed-off-by: Milos Gajdos <milosthegajdos@gmail.com>
Signed-off-by: Milos Gajdos <milosthegajdos@gmail.com>
Signed-off-by: Milos Gajdos <milosthegajdos@gmail.com>
Signed-off-by: Milos Gajdos <milosthegajdos@gmail.com>
Signed-off-by: Milos Gajdos <milosthegajdos@gmail.com>
2bc76e3
to
b9b96d9
Compare
I've decided to bump the Go version in |
I mean, we don't use the matrix, and break them into two jobs. |
I think the matrix works well. No need for unnecessary redundancy IMHO 🤷♂️ |
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.
lgtm
It would appear that requesting Go 1.21 in the build matrix has no effect whatsoever on what go toolchain is actually used to build the project. See https://brandur.org/fragments/go-version-matrix.
Specifying 1.22.0 in the go.mod go directive forces the 1.22 toolchain to be used for building Go source files, ignoring whatever Go version we set in the GHA CI matrix.
You can see the "wrong" toolchain to be used in the screenshot below:
Luckily we can enforce the right setting by setting
GOTOOLCHAIN=local
which forces Go to use the locally available toolchain instead of downloading the one requested by go.mod.If we want to be one minor version back compatible we need to drop the go.mod go directive to 1.21.0, too.
As for the image builds, the Docker image we use sets the
GOTOOLCHAIN=local
by default: