Skip to content

Syncs last two minor versions of go when building internal images#387

Merged
codefromthecrypt merged 2 commits intomasterfrom
new-dockerfile
Oct 12, 2021
Merged

Syncs last two minor versions of go when building internal images#387
codefromthecrypt merged 2 commits intomasterfrom
new-dockerfile

Conversation

@codefromthecrypt
Copy link
Copy Markdown
Contributor

@codefromthecrypt codefromthecrypt commented Oct 6, 2021

Syncing the last two versions of go (installed on the GHA runner) allows
PRs to choose go 1.18 once it is available and not have a race-condition
publishing Docker images.

This unsets GOROOT for consistency with GitHub Actions runner. We don't
need this because Makefile manages version selection.

This was referenced Oct 6, 2021
codefromthecrypt added a commit that referenced this pull request Oct 6, 2021
This prepares for #387 by looking up the homedir of the docker user
dynamically. This also deduplicates runner configuration.

Signed-off-by: Adrian Cole <adrian@tetrate.io>
@codefromthecrypt
Copy link
Copy Markdown
Contributor Author

it isn't likely go 1.18 will be out before February based on release cadence, but I'll do this anyway as otherwise I'll forget all the context. https://golang.org/doc/devel/release

@codefromthecrypt codefromthecrypt changed the title WIP: rewrite GitHub Actions runner Dockerfile Sync last two minor versions of go when building internal images Oct 11, 2021
@codefromthecrypt codefromthecrypt self-assigned this Oct 11, 2021
Syncing the last two versions of go (installed on the GHA runner) allows
PRs to choose go 1.18 once it is available and not have a race-condition
publishing Docker images.

This unsets GOROOT for consistency with GitHub Actions runner. We don't
need this because Makefile manages version selection.

Signed-off-by: Adrian Cole <adrian@tetrate.io>
@codefromthecrypt codefromthecrypt added ci enhancement New feature or request labels Oct 12, 2021
@codefromthecrypt codefromthecrypt changed the title Sync last two minor versions of go when building internal images Syncs last two minor versions of go when building internal images Oct 12, 2021
Signed-off-by: Adrian Cole <adrian@tetrate.io>
@codefromthecrypt codefromthecrypt marked this pull request as ready for review October 12, 2021 05:25
# Setup ENV variables used in make that match the GitHub Actions runner.
ENV RUNNER_TOOL_CACHE ${runner_tool_cache}
ARG go_stable_release
ENV GOROOT_${go_stable_release}_${arch} ${goroot_stable}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of the complexity here is caused by lack of variable substitution. ENV can only be build from build args. To change GOROOT_1_17_X64 into GOROOT_1_17_ARM64, we have to break GOROOT_1_17_X64 into 1_17, X64 then substitute arch with build args. If substitution worked, we could do replacement instead.

Another option I thought about but dismissed was manually building the multi-architecture image with manifest. In that way, you could pass different build args per platform, effectively resolving them externally. I did that before in Zipkin https://github.com/openzipkin/docker-alpine/blob/master/build-bin/docker/docker_push

However, I think most people don't understand manifests and it would be easier to understand if buildx was used even if it implied some complexity in the Dockerfile. Especially that there's >0 chance moby will add substitution.

https://github.com/moby/moby/issues/42904

@codefromthecrypt codefromthecrypt merged commit c5d554a into master Oct 12, 2021
@codefromthecrypt codefromthecrypt deleted the new-dockerfile branch October 12, 2021 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant