Version stamp: the build derives the version from git; .git is no longer excluded #69

Closed
opened 2026-10-02 02:18:42 +02:00 by clawbot · 0 comments
Collaborator

Owner's words (chat, 2026-10-02 ~00:00 UTC; the rollout across repos is sneak/project-management#21):

main.Version on sneak/api is set to "dev" instead of the git hash when being built under upaas, fix that

audit all other repos for that same bug. "docker build ." should pick up the git short rev or tag

The canonical documents prescribe the bug: the .dockerignore excludes .git, the Dockerfile example declares ARG VERSION=dev, and the policy says no stage may call git describe. upaas builds a clone with no build arguments, so every image built that way says dev. These documents change first; every other repo follows them.

The convention (already in sneak/upaas#242 and sneak/webhooker#410):

  • .dockerignore lets .git into the build context.
  • The stage that compiles has git (the Debian Go image has it; an alpine one needs apk add --no-cache git) and takes the version from the VERSION build argument when one is given, otherwise from git describe --tags --always (a tag when the commit has one, otherwise the short commit). ARG VERSION has no default.
  • The build fails if the context carries .git and the version still comes out empty, dev or unknown.
  • script/docker and script/cibuild may keep passing the version they compute on the host; it takes precedence.

What to change, on a branch cut from next, PR to next:

  • .dockerignore: drop .git and the comment above it; say in one comment why .git is sent.
  • prompts/REPO_POLICIES.md: the Dockerfile example's builder stage, its "Key points" bullet on ARG VERSION=dev, and the bullet "Excluding .git means git describe cannot run inside any build stage" are rewritten to the convention. The shallow-clone note on tag-derived versions stays.
  • prompts/NEW_REPO_CHECKLIST.md and prompts/EXISTING_REPO_CHECKLIST.md: the version bullets say the same.
  • prompts/CODE_STYLEGUIDE_GO.md and prompts/GO_HTTP_SERVER_CONVENTIONS.md: the Makefile comments that say .dockerignore excludes .git match the convention.
  • This repo's own Dockerfile, script/docker and script/cibuild: comments that say .dockerignore excludes .git match.

Definition of done:

  • No document or template in this repo says .git is excluded from the build context, declares ARG VERSION=dev, or forbids git describe in a build stage; each place that covers the version describes the convention above, in the same words where they repeat.
  • make check passes; independent review; squash to next.

Model: opus-5-5

Owner's words (chat, 2026-10-02 ~00:00 UTC; the rollout across repos is https://git.eeqj.de/sneak/project-management/issues/21): > main.Version on sneak/api is set to "dev" instead of the git hash when being built under upaas, fix that > audit all other repos for that same bug. "docker build ." should pick up the git short rev or tag The canonical documents prescribe the bug: the `.dockerignore` excludes `.git`, the Dockerfile example declares `ARG VERSION=dev`, and the policy says no stage may call `git describe`. upaas builds a clone with no build arguments, so every image built that way says `dev`. These documents change first; every other repo follows them. The convention (already in https://git.eeqj.de/sneak/upaas/pulls/242 and https://git.eeqj.de/sneak/webhooker/pulls/410): - `.dockerignore` lets `.git` into the build context. - The stage that compiles has `git` (the Debian Go image has it; an alpine one needs `apk add --no-cache git`) and takes the version from the `VERSION` build argument when one is given, otherwise from `git describe --tags --always` (a tag when the commit has one, otherwise the short commit). `ARG VERSION` has no default. - The build fails if the context carries `.git` and the version still comes out empty, `dev` or `unknown`. - `script/docker` and `script/cibuild` may keep passing the version they compute on the host; it takes precedence. What to change, on a branch cut from `next`, PR to `next`: - `.dockerignore`: drop `.git` and the comment above it; say in one comment why `.git` is sent. - `prompts/REPO_POLICIES.md`: the Dockerfile example's builder stage, its "Key points" bullet on `ARG VERSION=dev`, and the bullet "Excluding `.git` means `git describe` cannot run inside any build stage" are rewritten to the convention. The shallow-clone note on tag-derived versions stays. - `prompts/NEW_REPO_CHECKLIST.md` and `prompts/EXISTING_REPO_CHECKLIST.md`: the version bullets say the same. - `prompts/CODE_STYLEGUIDE_GO.md` and `prompts/GO_HTTP_SERVER_CONVENTIONS.md`: the Makefile comments that say `.dockerignore` excludes `.git` match the convention. - This repo's own `Dockerfile`, `script/docker` and `script/cibuild`: comments that say `.dockerignore` excludes `.git` match. Definition of done: - No document or template in this repo says `.git` is excluded from the build context, declares `ARG VERSION=dev`, or forbids `git describe` in a build stage; each place that covers the version describes the convention above, in the same words where they repeat. - `make check` passes; independent review; squash to `next`. Model: opus-5-5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/prompts#69