Stamp the git tag or short commit into the binary (closes #4) #5

Open
clawbot wants to merge 1 commits from clawbot/bsdaily:issue-4-version-stamp into main
First-time contributor

Implements #4: bsdaily now has main.Version, set at link time with -X, logged on the first line of every run and printed by bsdaily --version.

  • The Dockerfile's build stage installs git and stamps the VERSION build argument, else git describe --tags --always on the context's .git: the tag, tag-N-gHASH, or the short commit. It fails if the context carries .git and the result is empty, dev or unknown.
  • A host make build stamps the same git describe value, or dev when that yields nothing, replacing the Makefile's unused VERSION := 0.1.0-dev.
  • New .dockerignore: the canonical copy from sneak/prompts next, plus this repo's host-built /bsdaily, /coverage.out and /coverage.html. .git is sent for the version; .git/config stays out because it can hold a credential, and git describe does not need it.
  • script/docker says it is identical in all repos, so it is now the canonical copy: it builds with --no-cache and passes the host-derived version.
  • TODO.md no longer lists .dockerignore as still to add.

Worth knowing:

  • script/cibuild is unchanged: it passes no VERSION, so the build derives it.
  • An image built with neither .git nor VERSION reports dev.

Disclosures:

  • Not changed: the vendored REPO_POLICIES.md, still showing ARG VERSION=dev.
  • No unit test: only the builds, one log line and one cobra field changed.
  • Opened from the clawbot/bsdaily fork: clawbot can only read sneak/bsdaily.

Model: opus-5-5

Implements https://git.eeqj.de/sneak/bsdaily/issues/4: bsdaily now has `main.Version`, set at link time with `-X`, logged on the first line of every run and printed by `bsdaily --version`. - The `Dockerfile`'s build stage installs `git` and stamps the `VERSION` build argument, else `git describe --tags --always` on the context's `.git`: the tag, `tag-N-gHASH`, or the short commit. It fails if the context carries `.git` and the result is empty, `dev` or `unknown`. - A host `make` build stamps the same `git describe` value, or `dev` when that yields nothing, replacing the `Makefile`'s unused `VERSION := 0.1.0-dev`. - New `.dockerignore`: the canonical copy from `sneak/prompts` `next`, plus this repo's host-built `/bsdaily`, `/coverage.out` and `/coverage.html`. `.git` is sent for the version; `.git/config` stays out because it can hold a credential, and `git describe` does not need it. - `script/docker` says it is identical in all repos, so it is now the canonical copy: it builds with `--no-cache` and passes the host-derived version. - `TODO.md` no longer lists `.dockerignore` as still to add. Worth knowing: - `script/cibuild` is unchanged: it passes no `VERSION`, so the build derives it. - An image built with neither `.git` nor `VERSION` reports `dev`. Disclosures: - Not changed: the vendored `REPO_POLICIES.md`, still showing `ARG VERSION=dev`. - No unit test: only the builds, one log line and one cobra field changed. - Opened from the `clawbot/bsdaily` fork: clawbot can only read `sneak/bsdaily`. Model: opus-5-5
clawbot self-assigned this 2026-10-02 09:49:32 +02:00
clawbot force-pushed issue-4-version-stamp from 5ce79f7eed to 613817c4fd 2026-10-02 10:03:52 +02:00 Compare
Author
First-time contributor

Review failed.

  1. cmd/bsdaily/main.go: the version is only in --version output. A run logs no version, so the definition of done in #4 (the version in the first startup log line) and the Go styleguide's "include it in startup logs" are not met. bsdaily is a batch job that logs its progress, so being a command-line tool does not exempt it. Acceptable: the first log line of every run carries the version; keeping --version is fine.
  2. .dockerignore: the canonical copy is not extended with this repo's own host-built artifacts, which its own comment and REPO_POLICIES.md require. After a host make, the root bsdaily binary (and coverage.out/coverage.html from make test-coverage) go into the build context and the lint and build stages. Acceptable: anchored entries /bsdaily, /coverage.out, /coverage.html.
  3. Makefile with cmd/bsdaily/main.go: when git describe yields nothing on the host (no git checkout, no git), make links an empty main.Version, and bsdaily then rejects --version as an unknown flag. The comment on Version says such builds report dev. Acceptable: an empty stamp still reports dev, as the Dockerfile already does for a context without .git.
  4. TODO.md: Next Step and Future Steps still say to add .dockerignore, which this PR adds. Acceptable: drop it from both.

Model: opus-5-5

Review failed. 1. `cmd/bsdaily/main.go`: the version is only in `--version` output. A run logs no version, so the definition of done in https://git.eeqj.de/sneak/bsdaily/issues/4 (the version in the first startup log line) and the Go styleguide's "include it in startup logs" are not met. bsdaily is a batch job that logs its progress, so being a command-line tool does not exempt it. Acceptable: the first log line of every run carries the version; keeping `--version` is fine. 2. `.dockerignore`: the canonical copy is not extended with this repo's own host-built artifacts, which its own comment and `REPO_POLICIES.md` require. After a host `make`, the root `bsdaily` binary (and `coverage.out`/`coverage.html` from `make test-coverage`) go into the build context and the lint and build stages. Acceptable: anchored entries `/bsdaily`, `/coverage.out`, `/coverage.html`. 3. `Makefile` with `cmd/bsdaily/main.go`: when `git describe` yields nothing on the host (no git checkout, no `git`), `make` links an empty `main.Version`, and bsdaily then rejects `--version` as an unknown flag. The comment on `Version` says such builds report `dev`. Acceptable: an empty stamp still reports `dev`, as the Dockerfile already does for a context without `.git`. 4. `TODO.md`: Next Step and Future Steps still say to add `.dockerignore`, which this PR adds. Acceptable: drop it from both. Model: opus-5-5
clawbot added 1 commit 2026-10-02 10:38:46 +02:00
Stamp the git tag or short commit into the binary (closes #4)
check / check (pull_request) Blocked by required conditions
2cd390e62e
A plain `docker build .` now stamps the version into bsdaily: the
VERSION build argument when one is given, otherwise `git describe
--tags --always` of the .git in the build context. The build fails if
the context carries .git and no version comes out. A host `make` build
stamps the same `git describe` value, or dev when it yields nothing.
bsdaily logs the version on the first line of every run and prints it
with --version.

The new .dockerignore is the canonical copy, which keeps .git/config
out of the build context, plus this repo's host-built artifacts.
script/docker is replaced with the canonical copy, which passes the
version it derives on the host.

Model: opus-5-5
clawbot force-pushed issue-4-version-stamp from 613817c4fd to 2cd390e62e 2026-10-02 10:38:46 +02:00 Compare
Some checks are pending
1 workflow awaiting approval

The workflow will only run after approval from the repository maintainer.

check / check (pull_request) Blocked by required conditions
You are not authorized to merge this pull request.
This pull request can be merged automatically.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u https://git.eeqj.de/clawbot/bsdaily issue-4-version-stamp:clawbot-issue-4-version-stamp
git checkout clawbot-issue-4-version-stamp
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/bsdaily#5