Dockerfile lint-stage pin comment is misleading and inconsistently formatted #25
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Two cosmetic-but-real defects on the lint stage, raised as non-blocking findings during the review of PR #2.
1. The comment says something untrue.
Dockerfile:2reads:REPO_POLICIES requires the form
# image:vX.Y.Z, YYYY-MM-DDabove every hash-pinned reference. The(Debian-based)parenthetical breaks that form, and worse, it implies the v2.12.2 bump changed the base distribution. It did not — the reviewer ran both the old and new digests and confirmed v2.12.1 was Debian trixie too. A comment that explains a change that never happened is worse than no comment.2. The pin form is inconsistent with its siblings.
Dockerfile:3usesFROM golangci/golangci-lint:v2.12.2@sha256:..., while the builder and runtime stages both use the bareFROM image@sha256:...form, which is also what the policy template shows. Security-neutral — the digest governs either way — but threeFROMlines in one file should not use two conventions.Definition of done
Dockerfile:2reads exactly# golangci/golangci-lint:v2.12.2, 2026-08-07.Dockerfile:3uses the bareFROM golangci/golangci-lint@sha256:...form, matching the other two stages and the policy template. The digest is unchanged:sha256:5cceeef04e53efe1470638d4b4b4f5ceefd574955ab3941b2d9a68a8c9ad5240.golangandalpinepins are checked against the same required format while in there.make checkgreen andmake dockersucceeds, still building the lint stage from the same digest.Still live after #46 (
d43c1d3),and now doubled:
Dockerfile.lintcarries the same(Debian-based)parenthetical and the same tag-plus-digestFROMform. Both files are in scope.
Implementation requirements:
Dockerfile:2and the corresponding comment inDockerfile.lintread exactly
# golangci/golangci-lint:v2.12.2, 2026-08-07.FROMlines use the bareFROM golangci/golangci-lint@sha256:...form. Digest unchanged:
sha256:5cceeef04e53efe1470638d4b4b4f5ceefd574955ab3941b2d9a68a8c9ad5240.golangandalpinepin comments against the same formatwhile in there.
The trap:
script/verify-lint-image-pinexists to keep those twoFROMlines identical and parses them to do it. Dropping the tagchanges what it parses. Read it first, keep it working, and prove it
still fails on a tag-only and a digest-only disagreement after the
change — a guard that silently stops comparing is worse than the
inconsistency being fixed.
make checkgreen andmake dockerstill building both images fromthe same digest.
Done on
nextas337b319.Both files now read
# golangci/golangci-lint:v2.12.2, 2026-08-07overFROM golangci/golangci-lint@sha256:5cceeef04e53efe1470638d4b4b4f5ceefd574955ab3941b2d9a68a8c9ad5240.Digest unchanged. The
golangandalpinepin comments already matchedthe required form; untouched.
Guard (
script/verify-lint-image-pin): its awk matchesgolangci/golangci-lint[:@], so the tagless reference still parses — nologic change was needed. Evidence, all after the change:
ran the gate live, not cached (
make check,Dockerfile.lint:gate lint-image-pin...agree on ...@sha256:5cce...;make docker,lint stage
[7/9], same output).the build — perturbing
Dockerfileto a zero digest aborteddocker build -f Dockerfile.lint .at[6/8]gate lint-image-pinwithexit code: 1. Perturbation reverted.reference carries a tag. Tag drift is still caught: a tag
reintroduced on one side only is a plain string mismatch and fails
(verified against fixtures), as do two differing tags if tags ever
return.
empty-vs-empty compare. Mangling the image name gives
expected exactly one golangci/golangci-lint FROM reference, found 0and exit 1, whether one file or both are mangled.
One deviation, disclosed rather than folded in: the guard's advice line
said "bump both FROM lines together, tag and digest", which is now
inaccurate; it reads "bump both FROM lines together so ...". Message
text only, no logic.
Verification:
make checkgreen with the linter demonstrably executing(
gate lint36.2s,0 issues., notCACHED; testsok sneak.berlin/go/sfdupes 2.427s).make dockergreen, both imagesbuilt from that same digest, lint gates 35.7s, builder
gate test32.3s.Not run: any behaviour, ordering or gate change; nothing outside the two
Dockerfiles, that one message line, and the
TODO.mdentry.