Repository navigation
✨ feat: build-stamped version for both binaries (VERSION-01) - #290
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
1e1fd4f to
f6260d8
Compare
konih
left a comment
There was a problem hiding this comment.
REVIEW: APPROVE (external-contributor path — reviewed per /merge-open-prs Step 3)
The check that mattered: ARG scoping. A global ARG declared before FROM is not visible inside a build stage, which would have made the -X substitutions expand to empty strings and silently ship an unstamped binary — and CI would never have caught it, because the docker-build job passes no --build-arg and would produce the same dev/unknown either way. Verified both files declare VERSION/COMMIT/DATE after FROM ... AS builder (Dockerfile:8-10, Dockerfile.pipeline:10-12), so the args are in-stage and the RUN go build expands them correctly. The defaults also match internal/version's own Go defaults, so a plain docker build reports dev/unknown honestly rather than a plausible-looking fake version.
Verified end-to-end, not just by reading. Built both binaries from this branch with the Taskfile ldflags:
$ ./bin/kollect-pipeline --version
kollect-pipeline version v0.17.0-35-gf6260d8d6 (commit f6260d8d6, built 2026-08-10T14:19:13Z)
$ ./bin/manager --version
v0.17.0-35-gf6260d8d6 (commit f6260d8d6, built 2026-08-10T14:19:34Z)
This is worth stating explicitly because -X fails silently when the symbol path is wrong — it is a no-op, not a build error. Both binaries stamp for real.
Architecture — internal/version is added to the existing shared component, which is already in commonComponents. That is the minimal correct placement for a leaf package whose only import is fmt; it does not widen cmd/ → internal/ access generally.
Other
--versionon the manager prints andos.Exit(0)s before any manager/webhook setup, so it works without a cluster or valid config.build:clicorrectly gainsinternal/version/**in itssources:list, so Taskfile's up-to-date check won't serve a stale binary after a version-package edit.- Defaults are asserted in
TestBindStartupFlags_Defaults, so--versioncan't silently flip to true.
Follow-up (disclosed in the PR body, not a blocker) — the release workflow and Makefile don't yet pass --build-arg VERSION/COMMIT/DATE, so published container images will still report dev/unknown until that is wired. The deferral is reasonable given #284 (ADR-0708 hub distribution) is in flight over the same files, but this should land before the next release tag or the shipped images will carry a version string that is honest but useless. Worth a follow-up story.
CI green across all checks.
f6260d8 to
441cd9d
Compare
Neither binary had any build-stamped version: all four build sites (Taskfile.yml's build/build:cli tasks, Dockerfile, Dockerfile.pipeline) used plain -ldflags="-w -s", no -X, no internal/version package — so both shipped with no way to tell what commit or release they were built from. Adds internal/version (Version/Commit/Date vars + String(), "dev"/"unknown" defaults for go build/run/test without -ldflags) and wires it into all four build sites: Taskfile.yml computes git describe/rev-parse/date locally; the two Dockerfiles take VERSION/COMMIT/DATE build-args (defaulted so a plain `docker build` still works) for the release pipeline to pass in. The manager gets a --version flag; kollect-pipeline gets cobra's built-in --version via Command.Version. Left out: wiring real --build-arg values into the Makefile/release workflow, since both are being touched by the in-flight ADR-0708 hub-distribution PR (#284).
441cd9d to
7bc7b12
Compare
|



Neither binary had any build-stamped version: all four build sites (Taskfile.yml's build/build:cli tasks, Dockerfile, Dockerfile.pipeline) used plain -ldflags="-w -s", no -X, no internal/version package — so both shipped with no way to tell what commit or release they were built from.
Adds internal/version (Version/Commit/Date vars + String(), "dev"/"unknown" defaults for go build/run/test without -ldflags) and wires it into all four build sites: Taskfile.yml computes git describe/rev-parse/date locally; the two Dockerfiles take VERSION/COMMIT/DATE build-args (defaulted so a plain
docker buildstill works) for the release pipeline to pass in. The manager gets a --version flag; kollect-pipeline gets cobra's built-in --version via Command.Version.Left out: wiring real --build-arg values into the Makefile/release workflow, since both are being touched by the in-flight ADR-0708 hub-distribution PR (#284).