fix: keep Go image digest pinned when GO_VERSION is overridden - #2207
Open
Namanlashkari wants to merge 3 commits into
Open
fix: keep Go image digest pinned when GO_VERSION is overridden#2207Namanlashkari wants to merge 3 commits into
Namanlashkari wants to merge 3 commits into
Conversation
|
|
Namanlashkari
marked this pull request as ready for review
August 26, 2026 14:46
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
GO_VERSIONis passed as a build-arg from the release workflow. It is only the version extracted fromgo.mod(for example1.26.6). That overrides the Dockerfile defaulttag@digestvalue, so published images are built from an unpinnedgolang:1.26.6base. The digest pinning in the Dockerfile does not take effect for release builds.#1998
ref: #1997 (comment)
Fix
Split the Go image pin into two args:
GO_VERSION— tag only (1.26.6)GO_IMAGE_DIGEST— digest (sha256:…)FROMis nowgolang:${GO_VERSION}@${GO_IMAGE_DIGEST}. The release workflow can still passGO_VERSIONfromgo.mod; the digest stays in the Dockerfile.Testing
Manual (Docker Desktop, linux/arm64):
golang:1.26.6@sha256:0d1d3a794be25f809dd2cb3160d8c73276c4056a9f8242a138e908ddeee7b6b6(digest kept afterGO_VERSIONoverride)sha256:1b39ce0f95713cb2c73c0df47d68a36700c7c27c18c71f37ec4a71610dac7cac)CI:
GO_VERSIONno longer strips the digest