Report the version: docker build . stamps the git tag or short commit (closes #7) #8

Open
clawbot wants to merge 1 commits from issue-7-version-stamp into next
Collaborator

A plain docker build . of a clone now stamps the commit into the binary, for #7. attrsum had no version; it now has --version.

  • attrsum.go: a Version string (default dev), set at link time with -X and printed by cobra's built-in --version. -v stays verbose.
  • Makefile: make build stamps git describe --tags --always --dirty, or dev without git; make build VERSION=x stamps x.
  • Dockerfile: the compiling stage takes the VERSION build argument when given, otherwise git describe --tags --always on the .git in the context, and fails if .git is present and the result is empty, dev or unknown. Without .git it stamps dev.
  • .dockerignore: new, the canonical copy from sneak/prompts next; it sends .git but not .git/config, which can hold a credential. Below the shared part, this repo's own /attrsum (the host-built binary .gitignore already lists), so a host build never enters the image.
  • .gitea/workflows/check.yml: the checkout step fetches full history (fetch-depth: 0), so CI sees the 1.0.0 tag and stamps the same 1.0.0-N-gHASH as a full clone.
  • script/docker: replaced with the canonical copy, since it says it is identical in all repos. It now builds with --no-cache and passes the host's version as VERSION.

Worth knowing: script/cibuild is unchanged; it is not the shared copy, and its plain docker build . now finds the version itself.

Judgement call: no unit test; the linker sets the value and cobra prints it.

Model: opus-5-5

A plain `docker build .` of a clone now stamps the commit into the binary, for https://git.eeqj.de/sneak/attrsum/issues/7. attrsum had no version; it now has `--version`. - `attrsum.go`: a `Version` string (default `dev`), set at link time with `-X` and printed by cobra's built-in `--version`. `-v` stays verbose. - `Makefile`: `make build` stamps `git describe --tags --always --dirty`, or `dev` without git; `make build VERSION=x` stamps `x`. - `Dockerfile`: the compiling stage takes the `VERSION` build argument when given, otherwise `git describe --tags --always` on the `.git` in the context, and fails if `.git` is present and the result is empty, `dev` or `unknown`. Without `.git` it stamps `dev`. - `.dockerignore`: new, the canonical copy from `sneak/prompts` `next`; it sends `.git` but not `.git/config`, which can hold a credential. Below the shared part, this repo's own `/attrsum` (the host-built binary `.gitignore` already lists), so a host build never enters the image. - `.gitea/workflows/check.yml`: the checkout step fetches full history (`fetch-depth: 0`), so CI sees the `1.0.0` tag and stamps the same `1.0.0-N-gHASH` as a full clone. - `script/docker`: replaced with the canonical copy, since it says it is identical in all repos. It now builds with `--no-cache` and passes the host's version as `VERSION`. Worth knowing: `script/cibuild` is unchanged; it is not the shared copy, and its plain `docker build .` now finds the version itself. Judgement call: no unit test; the linker sets the value and cobra prints it. Model: opus-5-5
clawbot added the needs-review label 2026-10-02 09:32:57 +02:00
clawbot self-assigned this 2026-10-02 09:32:57 +02:00
clawbot changed target branch from main to next 2026-10-02 09:33:50 +02:00
clawbot added 1 commit 2026-10-02 09:35:44 +02:00
attrsum --version now prints the git tag or short commit. make build
stamps it with -X from git describe, and the Dockerfile takes the VERSION
build argument when given, otherwise git describe --tags --always on the
.git in the build context, failing if .git is present and no version
comes out. A new .dockerignore, the canonical one, keeps .git/config out
of the context, and also this repo's host-built /attrsum. CI checks out
full history so it sees the 1.0.0 tag and stamps what a full clone does.
script/docker is replaced with the canonical copy.

Model: opus-5-5
clawbot force-pushed issue-7-version-stamp from c6497c2ccd to 876b621f2f 2026-10-02 09:35:44 +02:00 Compare
Author
Collaborator
  • TODO.md line 47: the Future Steps item "Add Dockerfile and .dockerignore that run make check, images pinned by sha256, plus a Makefile docker target" is now done (the Dockerfile and make docker already exist; this PR adds .dockerignore), yet it stays under Future Steps next to the new Completed Steps entry that records the .dockerignore, so the file contradicts itself. Remove that item in the same commit, as the file's own Workflow section says.
  • Dockerfile line 43: the build reports "no version could be derived" also when a VERSION build argument of dev or unknown was given and rejected (for example unknown from script/docker when git fails on the host), which sends the reader to debug git inside the build instead of the argument. Name the rejected value in the message, as the example in prompts/REPO_POLICIES.md on sneak/prompts next does (version is '$VERSION' although .git is present).

Model: opus-5-5

- `TODO.md` line 47: the Future Steps item "Add Dockerfile and .dockerignore that run make check, images pinned by sha256, plus a Makefile docker target" is now done (the `Dockerfile` and `make docker` already exist; this PR adds `.dockerignore`), yet it stays under Future Steps next to the new Completed Steps entry that records the `.dockerignore`, so the file contradicts itself. Remove that item in the same commit, as the file's own Workflow section says. - `Dockerfile` line 43: the build reports "no version could be derived" also when a `VERSION` build argument of `dev` or `unknown` was given and rejected (for example `unknown` from `script/docker` when git fails on the host), which sends the reader to debug git inside the build instead of the argument. Name the rejected value in the message, as the example in `prompts/REPO_POLICIES.md` on `sneak/prompts` `next` does (`version is '$VERSION' although .git is present`). Model: opus-5-5
clawbot added needs-rework and removed needs-review labels 2026-10-02 10:37:44 +02:00
Some checks are pending
check / check (push) Waiting to run
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 origin issue-7-version-stamp:issue-7-version-stamp
git checkout issue-7-version-stamp
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/attrsum#8