docker: report the real version in the image (closes #109) #182

Merged
clawbot merged 1 commits from issue-109-version-build-arg into next 2026-10-01 22:01:44 +02:00
Collaborator

Images now report the real version instead of dev.

  • The Dockerfile builder stage declares ARG VERSION=dev and runs
    make build VERSION="${VERSION}". A variable given on the make command
    line already overrides the Makefile's git describe default, so the
    Makefile only gains a comment saying so.
  • script/docker (make docker) runs git describe --tags --always --dirty
    on the host and passes the result as --build-arg VERSION. .dockerignore
    leaves .git out of the build context, which is why git describe inside
    the build always fell back to dev. Those lines are copied from the org's
    model script/docker.
  • logger.Identify, which logs starting with the version, was never called,
    so the startup log had no version at all. main now calls it before
    anything else starts. The health check response already carried the
    version.
  • README "Build-Time Variables" and the script/docker entry say where the
    version comes from.

With no tags in the repo yet, the version is the short commit hash, with
-dirty for a tree with uncommitted changes.

Disclosures:

  • A build that passes no argument (script/cibuild in CI, and upaas unless
    it passes one) still reports dev.
  • Judgement call: when git describe fails on the host, script/docker
    passes unknown (the model script's fallback), not the Makefile's dev.
  • No test covers the new Identify call in main; nothing in main has
    tests.

Closes #109

Model: opus-5-5

Images now report the real version instead of `dev`. - The `Dockerfile` builder stage declares `ARG VERSION=dev` and runs `make build VERSION="${VERSION}"`. A variable given on the `make` command line already overrides the `Makefile`'s `git describe` default, so the `Makefile` only gains a comment saying so. - `script/docker` (`make docker`) runs `git describe --tags --always --dirty` on the host and passes the result as `--build-arg VERSION`. `.dockerignore` leaves `.git` out of the build context, which is why `git describe` inside the build always fell back to `dev`. Those lines are copied from the org's model `script/docker`. - `logger.Identify`, which logs `starting` with the version, was never called, so the startup log had no version at all. `main` now calls it before anything else starts. The health check response already carried the version. - README "Build-Time Variables" and the `script/docker` entry say where the version comes from. With no tags in the repo yet, the version is the short commit hash, with `-dirty` for a tree with uncommitted changes. Disclosures: - A build that passes no argument (`script/cibuild` in CI, and upaas unless it passes one) still reports `dev`. - Judgement call: when `git describe` fails on the host, `script/docker` passes `unknown` (the model script's fallback), not the `Makefile`'s `dev`. - No test covers the new `Identify` call in `main`; nothing in `main` has tests. Closes https://git.eeqj.de/sneak/dnswatcher/issues/109 Model: opus-5-5
clawbot added this to the 1.0 milestone 2026-10-01 21:44:19 +02:00
clawbot added the needs-review label 2026-10-01 21:44:19 +02:00
clawbot self-assigned this 2026-10-01 21:44:19 +02:00
Author
Collaborator

Review passed on eb7a1f2.

Model: opus-5-5

Review passed on eb7a1f2. Model: opus-5-5
clawbot added 1 commit 2026-10-01 22:01:16 +02:00
The Dockerfile builder stage takes ARG VERSION (default `dev`) and passes
it to `make build` on the command line, which overrides the Makefile's
`git describe` default. script/docker computes the version from
`git describe` on the host and passes it as --build-arg VERSION, because
.dockerignore leaves .git out of the build context and `git describe`
inside the build only ever produced `dev`. A build that passes no
argument, such as script/cibuild, still reports `dev`.

`logger.Identify`, which logs `starting` with the version, was never
called; `main` now calls it first, so the version is in the startup log.

Model: opus-5-5
clawbot force-pushed issue-109-version-build-arg from eb7a1f2d3b to af79b46d17 2026-10-01 22:01:16 +02:00 Compare
clawbot merged commit bea9a3b2f2 into next 2026-10-01 22:01:44 +02:00
clawbot deleted branch issue-109-version-build-arg 2026-10-01 22:01:44 +02:00
clawbot removed the needs-review label 2026-10-01 22:01:45 +02:00
Sign in to join this conversation.