From 01954b6946dc26802d83520b27b826a88bee0411 Mon Sep 17 00:00:00 2001 From: clawbot <35+clawbot@noreply.example.org> Date: Tue, 6 Oct 2026 06:33:19 +0200 Subject: [PATCH] Say that a build from a linked worktree needs the version passed in (closes #111) A plain `docker build .` from a checkout whose `.git` is a file (a linked worktree, or a repository checked out as a submodule) stops at the version check of the canonical `Dockerfile` example: that file points to a git directory outside the build context, so `git describe` prints nothing. The check is right to refuse an empty version; what was missing is what to do. `prompts/REPO_POLICIES.md` and both checklists now say such a build is given its version with `--build-arg VERSION=...`, as `script/docker` and `script/cibuild` already do. The check itself is unchanged. Model: opus-5-5 --- TODO.md | 8 ++++++++ prompts/EXISTING_REPO_CHECKLIST.md | 12 ++++++++---- prompts/NEW_REPO_CHECKLIST.md | 6 ++++++ prompts/REPO_POLICIES.md | 6 ++++++ 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/TODO.md b/TODO.md index 0057a3b..901e61d 100644 --- a/TODO.md +++ b/TODO.md @@ -21,6 +21,14 @@ fmt-check, and commit. # Completed Steps +- 2026-10-06: `REPO_POLICIES.md` and both checklists now say that a checkout + whose `.git` is a file, a linked worktree or a repository checked out as a + submodule, is the exception to a plain `docker build .` succeeding (issue + 111): that file points to a git directory outside the build context, so the + build cannot read the version and the version check in the canonical + `Dockerfile` stops it. Such a build is given its version with + `--build-arg VERSION=...`, as `script/docker` and `script/cibuild` already do. + The check itself is unchanged. - 2026-10-06: The canonical `.gitea/workflows/check.yml` now has a `concurrency` block, so a new push cancels the older run on the same branch and no other, and its checkout step sets `persist-credentials: false`, so the job's token is diff --git a/prompts/EXISTING_REPO_CHECKLIST.md b/prompts/EXISTING_REPO_CHECKLIST.md index b12ee3b..cb7efd1 100644 --- a/prompts/EXISTING_REPO_CHECKLIST.md +++ b/prompts/EXISTING_REPO_CHECKLIST.md @@ -91,10 +91,14 @@ with your task. version still comes out empty, `dev` or `unknown`. A plain `docker build .` with no build arguments must succeed; a Dockerfile that refuses an empty build argument drops that refusal and keeps the argument. - `script/docker` and `script/cibuild` pass the version they compute on the - host; it takes precedence. A tag-derived version additionally needs - `fetch-depth: 0` on the CI checkout step, which clones shallow and fetches - no tags by default. + A checkout whose `.git` is a file (a linked worktree, or a repository + checked out as a submodule) is the exception: that file points to a git + directory outside the build context, so the build cannot read the version + and a plain `docker build .` fails; pass the version with + `--build-arg VERSION=...`. `script/docker` and `script/cibuild` already + pass the version they compute on the host; it takes precedence. A + tag-derived version additionally needs `fetch-depth: 0` on the CI checkout + step, which clones shallow and fetches no tags by default. - [ ] Gitea Actions workflow in `.gitea/workflows/` runs `script/cibuild` on push, checks out with `persist-credentials: false`, and carries the `concurrency` block that lets a new push cancel only the same branch's diff --git a/prompts/NEW_REPO_CHECKLIST.md b/prompts/NEW_REPO_CHECKLIST.md index ab43568..3f64ae3 100644 --- a/prompts/NEW_REPO_CHECKLIST.md +++ b/prompts/NEW_REPO_CHECKLIST.md @@ -97,6 +97,12 @@ Template files can be fetched from: version still comes out empty, `dev` or `unknown`. A plain `docker build .` with no build arguments must succeed; a Dockerfile that refuses an empty build argument drops that refusal and keeps the argument. + A checkout whose `.git` is a file (a linked worktree, or a repository + checked out as a submodule) is the exception: that file points to a git + directory outside the build context, so the build cannot read the version + and a plain `docker build .` fails; pass the version with + `--build-arg VERSION=...`, as `script/docker` and `script/cibuild` already + do. - The Dockerfile carries a `lint` phase and a `test` phase, each invoking its tool directly rather than through `make` or `script/`, and the final stage carries a `COPY --from=` of a harmless file from each so the image diff --git a/prompts/REPO_POLICIES.md b/prompts/REPO_POLICIES.md index 73a0b8c..5dc9ddd 100644 --- a/prompts/REPO_POLICIES.md +++ b/prompts/REPO_POLICIES.md @@ -281,6 +281,12 @@ style conventions are in separate documents: `.git` and the version still comes out empty, `dev` or `unknown`. A plain `docker build .` with no build arguments must succeed; a Dockerfile that refuses an empty build argument drops that refusal and keeps the argument. + A checkout whose `.git` is a file (a linked worktree, or a repository + checked out as a submodule) is the exception: that file points to a git + directory outside the build context, so the build cannot read the version + and a plain `docker build .` fails; pass the version with + `--build-arg VERSION=...`, as `script/docker` and `script/cibuild` already + do. - Every repo should have a Gitea Actions workflow (`.gitea/workflows/`) that runs `script/cibuild` on push, and checks out the repo as its only other step,