Stamp the tag or short commit in a plain docker build (closes #21) #22

Merged
clawbot merged 1 commits from issue-21-version-from-git into next 2026-10-02 08:14:00 +02:00
Collaborator

Closes #21. A plain docker build . of a clone, which is how upaas builds, stamped dev: .dockerignore left out .git and the build stage declared ARG VERSION=dev.

  • .dockerignore sends .git but keeps out .git/config, which can hold a credential and which git describe does not need; the comment is the canonical one from sneak/prompts.
  • The build stage (its Debian Go image has git) stamps the VERSION build argument when one is given, otherwise git describe --tags --always: the tag on a tagged commit, tag-N-gHASH after one, the short commit when no tag is reachable. If the context carries .git and the version is still empty, dev or unknown, the build fails, as in the canonical step.
  • script/docker says it is identical in all repos, so it is now the canonical copy: it builds with --no-cache and passes git describe --tags --always --dirty as VERSION.

What the diff does not show:

  • script/cibuild passes no version, so CI now takes it from .git in the build.
  • Dockerfile.lint shares .dockerignore, so .git reaches the lint build too.
  • No buildarch in the repo.

Disclosures:

  • A context with neither .git nor VERSION (a source tarball) now stamps an empty version instead of dev, as the canonical template does.
  • Judgement call: this repo's .dockerignore is not a copy of the canonical one, so only the .git/config block comes from it.
  • docs/REPO_POLICIES.md still shows ARG VERSION=dev; it is the synced canonical copy, left alone.

Model: opus-5-5

Closes https://git.eeqj.de/sneak/simplexcalc/issues/21. A plain `docker build .` of a clone, which is how upaas builds, stamped `dev`: `.dockerignore` left out `.git` and the build stage declared `ARG VERSION=dev`. - `.dockerignore` sends `.git` but keeps out `.git/config`, which can hold a credential and which `git describe` does not need; the comment is the canonical one from `sneak/prompts`. - The build stage (its Debian Go image has `git`) stamps the `VERSION` build argument when one is given, otherwise `git describe --tags --always`: the tag on a tagged commit, `tag-N-gHASH` after one, the short commit when no tag is reachable. If the context carries `.git` and the version is still empty, `dev` or `unknown`, the build fails, as in the canonical step. - `script/docker` says it is identical in all repos, so it is now the canonical copy: it builds with `--no-cache` and passes `git describe --tags --always --dirty` as `VERSION`. What the diff does not show: - `script/cibuild` passes no version, so CI now takes it from `.git` in the build. - `Dockerfile.lint` shares `.dockerignore`, so `.git` reaches the lint build too. - No `buildarch` in the repo. Disclosures: - A context with neither `.git` nor `VERSION` (a source tarball) now stamps an empty version instead of `dev`, as the canonical template does. - Judgement call: this repo's `.dockerignore` is not a copy of the canonical one, so only the `.git/config` block comes from it. - `docs/REPO_POLICIES.md` still shows `ARG VERSION=dev`; it is the synced canonical copy, left alone. Model: opus-5-5
clawbot added the needs-review label 2026-10-02 07:13:27 +02:00
clawbot self-assigned this 2026-10-02 07:13:27 +02:00
clawbot added 1 commit 2026-10-02 07:13:27 +02:00
A plain `docker build .` of a clone stamped `dev`: `.dockerignore` left
out `.git` and the build stage declared `ARG VERSION=dev`. `.git` now
reaches the build context without `.git/config`, which can hold a
credential, and the build stage takes the VERSION build argument when
given, otherwise `git describe --tags --always`. A context that carries
`.git` but yields no version fails the build.

`script/docker` is replaced with the current canonical copy, which
passes the version it derives on the host.

Model: opus-5-5
Author
Collaborator

Review passed.

Model: opus-5-5

Review passed. Model: opus-5-5
clawbot merged commit 2bf73c478f into next 2026-10-02 08:14:00 +02:00
clawbot deleted branch issue-21-version-from-git 2026-10-02 08:14:00 +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/simplexcalc#22