Dockerfile does not implement the mandated fail-fast lint stage, and does not pass VERSION as a build ARG #109
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?
REPO_POLICIES.mddevotes a long, explicit section to the required multistage Go Dockerfile pattern, including a canonical template. This repo's Dockerfile does not follow it.Current state (audited against
origin/main, commit9347a28)The whole Dockerfile is two stages —
builderand runtime:Divergences from the mandated pattern:
lintstage. The policy requires an independent stageFROM golangci/golangci-lint@sha256:...that runsmake fmt-checkandmake lintbefore the build begins. That image is never referenced here.COPY --from=lint /src/go.sum /dev/nullstage dependency. The policy is explicit about why this line exists: "BuildKit runs stages in parallel by default; without this line, the build stage would not wait for lint to finish and a lint failure might not fail the overall build."make check, aftergo mod downloadand full compilation setup. The entire stated purpose of the pattern is that "lint failures surface in seconds rather than minutes."ARG VERSION. The canonical template declaresARG VERSION=devand injects it. Here,make buildshells out togit describe --tags --always --dirty(Makefile:4-5) — but.dockerignoreexcludes.git/, so there is no git metadata in the build context at all and the version string silently collapses to the|| echo "dev"fallback. Every image ever built by this Dockerfile reports versiondev. That is a release-correctness bug, not a style nit, and it will not fix itself when you tag 1.0.0.# goimports v0.42.0has a version but no date; the policy requires "a comment above the reference with the version and date (YYYY-MM-DD)". Every other pin in the repo is correctly commented.What is already correct — do not regress it
Every external reference in the repo is hash-pinned, which is the single most important rule in
REPO_POLICIES.md. Verified:golang@sha256:f6751d...,alpine@sha256:c3f8e73..., golangci-lint@c0d3ddc9cf3faa61a4e378e879ece580256d76e5, goimports@009367f5c17a8d4c45a961a3a509277190a9a6f0,actions/checkout@11bd71901bbe...in.gitea/workflows/check.yml, and Go module hashes ingo.sum.script/bootstrapuses package managers plus pinnedgo install— nocurl | shanywhere.Definition of done
lintstage based on thegolangci/golangci-lintimage, runningmake fmt-checkthenmake lint.COPY --from=lint /src/go.sum /dev/null.ARG VERSION=devis declared and threaded into the binary's version string so built images report a real version. Confirm by running the built image and checking the version it reports — do not assume it works from reading the Dockerfile.goimportspin comment gains its date.script/cibuild(plaindocker build .) still succeeds end to end, and the build stays under the policy's 5-minute ceiling.TODO.mdupdated in the same commit.The finishing commit's title must end with
(closes #N)referencing this issue.Hard constraints — read before starting
golangci/golangci-lintimage you add must be pinned bysha256digest and must be exactly v2.12.2, matching the existinggo installpinc0d3ddc9cf3faa61a4e378e879ece580256d76e5. A different linter version against this repo's v2-schema.golangci.ymlwill fail on config schema mismatch. Add the required# golangci/golangci-lint v2.12.2, YYYY-MM-DDcomment above it.:v2.12.2tag. Hash-pinning has zero exceptions in this repo. An honest "blocked, need the digest" is the correct outcome; a tag reference is not..golangci.yml. It is org-standardised and must never be touched by an agent. Its sha256 must remain021cc83f4e6fc7c31b95b34b846723dfcf20b66b7baeea1dc40406e643346bcb.Known interaction, do not "fix" it here
make checkinside the build runs the live-DNS resolver test suite, sodocker buildrequires outbound DNS from the build environment. DNS is never mocked in this repository, so that coupling is intentional. Test gating/flakiness is parked under #93 pending a decision from @sneak — do not add-short, skips, build tags, or mocks in this PR.