REPO_POLICIES: Version
check / check (push) Canceled after 0s

Cuts the fetch-depth sentence, which the CI section states, and moves
the reason ARG VERSION sits in the stage that compiles next to the
sentence saying it has no default; every rule stays.

Model: opus-5-5
This commit is contained in:
clawbot committed 2026-11-16 23:48:15 +00:00
1 parent 57d993ca21
commit e80de25c48
1 file changed
+17 -18
+17 -18
View File
@@ -543,6 +543,8 @@ style conventions are in separate documents:
- fails on a Mac without `timeout`, until it is installed. - fails on a Mac without `timeout`, until it is installed.
- needs `$HOME/.pipenv/bin` on `PATH`. - needs `$HOME/.pipenv/bin` on `PATH`.
## Version
- **A plain `docker build .` of a clone stamps the version that - **A plain `docker build .` of a clone stamps the version that
`git describe --tags --always` gives.** The version is derived from the `.git` `git describe --tags --always` gives.** The version is derived from the `.git`
in the build context, as the `prompts` repo's `examples/go.Dockerfile` shows. in the build context, as the `prompts` repo's `examples/go.Dockerfile` shows.
@@ -563,15 +565,11 @@ style conventions are in separate documents:
`--always` makes an untagged repo yield an abbreviated commit hash rather `--always` makes an untagged repo yield an abbreviated commit hash rather
than failing. The `[ -n "$version" ]` line is the single place the fallback than failing. The `[ -n "$version" ]` line is the single place the fallback
is applied. That line is a live check that fires on a build from an export is applied. It is a live check that fires on a build from an export with no
with no `.git`, and on a repository with no commits yet. Do not fold it into `.git`, and on a repository with no commits yet. Do not fold it into the
the substitution as `|| echo unknown`, which makes the guard unreachable. substitution as `|| echo unknown`, which makes the guard unreachable.
The Dockerfile's side is `ARG VERSION` in the stage that compiles, declared Passing `VERSION` to a repo whose Dockerfile declares no such `ARG` is
there because `ARG` is stage-scoped. Passing `VERSION` to a repo whose ignored and costs nothing, which is why the scripts stay byte-identical.
Dockerfile declares no such `ARG` is ignored and costs nothing, which is why
the scripts stay byte-identical. One consequence for CI: the standard
checkout action clones shallow and fetches no tags, so the canonical
`.gitea/workflows/check.yml` sets `fetch-depth: 0` on its checkout step.
- `.dockerignore` lets `.git` into the build context. It keeps out every git - `.dockerignore` lets `.git` into the build context. It keeps out every git
`config` at any depth (`**/.git/config`, `**/.git/modules/**/config`): `config` at any depth (`**/.git/config`, `**/.git/modules/**/config`):
- the repository's own - the repository's own
@@ -598,15 +596,16 @@ style conventions are in separate documents:
(`git config --system --add safe.directory /src`). A context sent as a (`git config --system --add safe.directory /src`). A context sent as a
tar stream keeps the sender's file owners, and git refuses a checkout tar stream keeps the sender's file owners, and git refuses a checkout
owned by another user, so the version would come out empty. owned by another user, so the version would come out empty.
`ARG VERSION` has no default. The build fails if the context carries `ARG VERSION` is declared in that stage, because `ARG` is stage-scoped.
`.git` and the version still comes out empty, `dev` or `unknown`. A It has no default. The build fails if the context carries `.git` and the
plain `docker build .` with no build arguments must succeed; a version still comes out empty, `dev` or `unknown`. A plain
Dockerfile that refuses an empty build argument drops that refusal and `docker build .` with no build arguments must succeed; a Dockerfile that
keeps the argument. A checkout whose `.git` is a file is the exception: refuses an empty build argument drops that refusal and keeps the
a linked worktree, or a repository checked out as a submodule. That file argument. A checkout whose `.git` is a file is the exception: a linked
points to a git directory outside the build context, so the build cannot worktree, or a repository checked out as a submodule. That file points
read the version and a plain `docker build .` fails. Pass the version to a git directory outside the build context, so the build cannot read
with `--build-arg VERSION=...`, as `script/docker` and `script/cibuild` the version and a plain `docker build .` fails. Pass the version with
`--build-arg VERSION=...`, as `script/docker` and `script/cibuild`
already do. already do.
- Every repo should have a Gitea Actions workflow (`.gitea/workflows/`) that - Every repo should have a Gitea Actions workflow (`.gitea/workflows/`) that