Stamp the git tag or short commit in a plain docker build (closes #86) #87

Merged
clawbot merged 1 commits from issue-86-docker-version-from-git into next 2026-10-02 04:26:41 +02:00
Collaborator

Implements #86: a plain docker build . of a clone now stamps the commit's tag or short commit into netwatch-server (the version field of its http begin listen log line and of the health check) instead of dev.

  • The builder stage installs git, copies the context's .git to /git, and takes the version from the VERSION build argument when one is given, otherwise from git describe --tags --always. A version that still comes out empty, dev or unknown fails the build. ARG VERSION has no default; backend/script/build still does the stamping.
  • .dockerignore leaves out .git/config: a clone's remote URL can carry a credential, and git describe does not need that file. .git itself was already in the context.
  • script/docker and script/cibuild keep passing their own version; only their comments changed, to the wording of sneak/prompts#70.

What the diff does not show:

  • .git goes to /git, not /src/.git: with git installed, go build would otherwise find it, record VCS details of a work tree holding only backend/, and could fail on a .git file.
  • No buildarch is left in the repo.

Disclosures:

  • Judgement call: the step has no [ -e .git ] test. The builder copies .git itself, so the test would always be true there. A context without .git already failed in the frontend stage (vite.config.js runs git rev-parse), and now also fails at that copy.
  • TODO.md has no entry: the brief allows TODO.md edits only where the issue names it.

Model: opus-5-5

Implements https://git.eeqj.de/sneak/netwatch/issues/86: a plain `docker build .` of a clone now stamps the commit's tag or short commit into `netwatch-server` (the `version` field of its `http begin listen` log line and of the health check) instead of `dev`. - The builder stage installs `git`, copies the context's `.git` to `/git`, and takes the version from the `VERSION` build argument when one is given, otherwise from `git describe --tags --always`. A version that still comes out empty, `dev` or `unknown` fails the build. `ARG VERSION` has no default; `backend/script/build` still does the stamping. - `.dockerignore` leaves out `.git/config`: a clone's remote URL can carry a credential, and `git describe` does not need that file. `.git` itself was already in the context. - `script/docker` and `script/cibuild` keep passing their own version; only their comments changed, to the wording of https://git.eeqj.de/sneak/prompts/pulls/70. What the diff does not show: - `.git` goes to `/git`, not `/src/.git`: with `git` installed, `go build` would otherwise find it, record VCS details of a work tree holding only `backend/`, and could fail on a `.git` file. - No `buildarch` is left in the repo. Disclosures: - Judgement call: the step has no `[ -e .git ]` test. The builder copies `.git` itself, so the test would always be true there. A context without `.git` already failed in the frontend stage (`vite.config.js` runs `git rev-parse`), and now also fails at that copy. - `TODO.md` has no entry: the brief allows `TODO.md` edits only where the issue names it. Model: opus-5-5
clawbot added the needs-review label 2026-10-02 03:54:20 +02:00
clawbot self-assigned this 2026-10-02 03:54:20 +02:00
clawbot added 1 commit 2026-10-02 03:54:21 +02:00
The builder stage now has git and takes the version from the VERSION
build argument when one is given, otherwise from `git describe --tags
--always` of the repo's .git, copied to /git so go build does not see
it. A version that still comes out empty, dev or unknown fails the
build. ARG VERSION has no default. .dockerignore keeps .git/config out
of the build context, and the comments in script/docker and
script/cibuild no longer say .git is excluded.

Model: opus-5-5
Author
Collaborator

Review passed.

Model: opus-5-5

Review passed. Model: opus-5-5
clawbot merged commit 4ce0814b14 into next 2026-10-02 04:26:41 +02:00
clawbot deleted branch issue-86-docker-version-from-git 2026-10-02 04:26:41 +02:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/netwatch#87