Skip to content

fix: keep Go image digest pinned when GO_VERSION is overridden - #2207

Open
Namanlashkari wants to merge 3 commits into
Kong:mainfrom
Namanlashkari:issue-1998-go-image-digest
Open

fix: keep Go image digest pinned when GO_VERSION is overridden#2207
Namanlashkari wants to merge 3 commits into
Kong:mainfrom
Namanlashkari:issue-1998-go-image-digest

Conversation

@Namanlashkari

@Namanlashkari Namanlashkari commented Aug 26, 2026

Copy link
Copy Markdown

Problem

GO_VERSION is passed as a build-arg from the release workflow. It is only the version extracted from go.mod (for example 1.26.6). That overrides the Dockerfile default tag@digest value, so published images are built from an unpinned golang:1.26.6 base. 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:

  1. GO_VERSION — tag only (1.26.6)
  2. GO_IMAGE_DIGEST — digest (sha256:…)

FROM is now golang:${GO_VERSION}@${GO_IMAGE_DIGEST}. The release workflow can still pass GO_VERSION from go.mod; the digest stays in the Dockerfile.

Testing

Manual (Docker Desktop, linux/arm64):

GO_VERSION=$(grep '^go ' go.mod | cut -d' ' -f2)
docker build \
  --build-arg GO_VERSION="$GO_VERSION" \
  --build-arg TAG=local-test \
  --build-arg COMMIT=deadbeef \
  -t deck:digest-test .
  • Build resolved golang:1.26.6@sha256:0d1d3a794be25f809dd2cb3160d8c73276c4056a9f8242a138e908ddeee7b6b6 (digest kept after GO_VERSION override)
  • Image built successfully (sha256:1b39ce0f95713cb2c73c0df47d68a36700c7c27c18c71f37ec4a71610dac7cac)

CI:

  • Release image job is unchanged except that GO_VERSION no longer strips the digest

@CLAassistant

CLAassistant commented Aug 26, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@Namanlashkari Namanlashkari changed the title fix(docker): keep Go image digest pinned fix: keep Go image digest pinned when GO_VERSION is overridden Aug 26, 2026
@Namanlashkari
Namanlashkari marked this pull request as ready for review August 26, 2026 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants