Drop the CACHEBUST build argument from script/lint, script/test, script/docker, script/cibuild and every Dockerfile stage. REPO_POLICIES now says check builds use Docker's normal cache: an unchanged tree reuses each step's stored result, which Docker keeps only for steps that succeeded. The rules on placing ARG CACHEBUST and re-vendoring it in one commit are gone; the rule that a planted defect proves a new or changed check stays. The README, the Go style guide and both checklists restated the cache-busting rules and are updated to match. The existing-repo checklist asks that no script pass --no-cache or CACHEBUST. Model: opus-5-5
This commit was merged in pull request #178.
This commit is contained in:
1 parent
1ad7ae14be
commit
964d973e3c
10 files changed
+101
-260
No files matched your search
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: New Repo Checklist
|
||||
last_modified: 2026-11-09
|
||||
last_modified: 2026-11-16
|
||||
---
|
||||
|
||||
Use this checklist when creating a new repository from scratch. Follow the steps
|
||||
@@ -118,23 +118,8 @@ Template files can be fetched from:
|
||||
stage carries a `COPY --from=` of a harmless file from each so the image
|
||||
cannot be built unless both passed. Keep the final stage last: a stage
|
||||
nothing depends on is built only when `--target` names it.
|
||||
- In every stage, every step that lints, tests or compiles comes after
|
||||
`ARG CACHEBUST`. `ARG CACHEBUST` comes right after these steps:
|
||||
- the steps that install system packages
|
||||
- the steps that download Go's modules
|
||||
- the step that runs `script/bootstrap` to install a Python `test`
|
||||
phase's packages from `Pipfile.lock`
|
||||
- A stage with none of these steps declares `ARG CACHEBUST` right after
|
||||
`FROM`. A step that also installs anything else comes after
|
||||
`ARG CACHEBUST` too. A `script/bootstrap` that also installs node packages
|
||||
is one. The `script/` builds pass a new `CACHEBUST` value on every build,
|
||||
which reruns every `RUN` step after that line and leaves the layers above
|
||||
it and the cache mounts in place; `--no-cache` would build those layers
|
||||
again and empty the mounts. A stage without the `ARG` line is served from
|
||||
cache on an unchanged tree, so the scripts and every stage's
|
||||
`ARG CACHEBUST` line are added in the same commit.
|
||||
- Go: each Go stage downloads the modules (`COPY go.mod go.sum ./`,
|
||||
`RUN go mod download`) above `ARG CACHEBUST`; the steps that compile
|
||||
`RUN go mod download`) before `COPY . .`; the steps that compile
|
||||
(`golangci-lint run`, `go test`, `go build`) mount Go's build cache
|
||||
(`--mount=type=cache,target=/root/.cache/go-build`), `golangci-lint run`
|
||||
also mounts golangci-lint's
|
||||
@@ -143,7 +128,7 @@ Template files can be fetched from:
|
||||
that timed out gets no rerun, as in the canonical Go `Dockerfile` in
|
||||
`REPO_POLICIES.md`
|
||||
- Python: a `test` phase that installs its packages from `Pipfile.lock` does
|
||||
it above `ARG CACHEBUST`, with `COPY script/ script/`,
|
||||
it before `COPY . .`, with `COPY script/ script/`,
|
||||
`COPY Pipfile Pipfile.lock ./` and `RUN script/bootstrap`. When
|
||||
`script/bootstrap` runs in that step, it installs nothing beyond these:
|
||||
- system packages
|
||||
@@ -161,8 +146,7 @@ Template files can be fetched from:
|
||||
for the image stops the install. In that step it installs no Python,
|
||||
because a step above it already did. `Pipfile` names no
|
||||
`python_version`, because `--deploy` stops when the distribution's
|
||||
Python differs from it. The tests run after `ARG CACHEBUST`, and every
|
||||
other stage installs its Python packages after it, as in the Python
|
||||
Python differs from it. The tests run after `COPY . .`, as in the Python
|
||||
`test` phase example in `REPO_POLICIES.md`
|
||||
|
||||
- Server: the final stage builds and runs the application
|
||||
@@ -227,13 +211,12 @@ are thin shims calling them. Model scripts:
|
||||
- [ ] `script/setup` / `make setup` — readies a fresh clone: runs `bootstrap`,
|
||||
then `install-precommit`, plus repo-specific init
|
||||
- [ ] `script/test` / `make test` —
|
||||
`docker build --build-arg CACHEBUST="$(date +%s)-$$" --target test --output type=cacheonly .`,
|
||||
which writes no image; the phase runs real tests, not a no-op (90-second
|
||||
timeout, 60-second hard cap on wall time)
|
||||
`docker build --target test --output type=cacheonly .`, which writes no
|
||||
image; the phase runs real tests, not a no-op (90-second timeout,
|
||||
60-second hard cap on wall time)
|
||||
- [ ] `script/lint` / `make lint` —
|
||||
`docker build --build-arg CACHEBUST="$(date +%s)-$$" --target lint --output type=cacheonly .`,
|
||||
which writes no image. No lint verdict may come from a host invocation of
|
||||
the linter.
|
||||
`docker build --target lint --output type=cacheonly .`, which writes no
|
||||
image. No lint verdict may come from a host invocation of the linter.
|
||||
- [ ] `script/fmt` / `make fmt` — formats code (writes; native, never in a
|
||||
container). Go code gets `gofmt`, then `golines -m 77`.
|
||||
- [ ] `script/fmt-check` / `make fmt-check` — checks formatting (read-only;
|
||||
@@ -245,16 +228,15 @@ are thin shims calling them. Model scripts:
|
||||
- [ ] `script/projectname` — outputs the project name (used by `script/docker`
|
||||
for the image tag)
|
||||
- [ ] `script/docker` / `make docker` — builds Docker image, tagged via
|
||||
`script/projectname` (byte-identical across repos); a new `CACHEBUST`
|
||||
value on every build, plus the version as a build arg
|
||||
`script/projectname` (byte-identical across repos), with the version as a
|
||||
build arg
|
||||
- [ ] `script/cibuild` — cd to repo root, run `script/bootstrap`, run
|
||||
`script/check`, then
|
||||
`docker build --build-arg CACHEBUST="$(date +%s)-$$" --build-arg VERSION="$version" -t "$tag" .`
|
||||
(what CI runs), with `$version` from
|
||||
`git describe --tags --always --dirty` (`unknown` if empty) and `$tag`
|
||||
from `script/projectname`, each assigned on its own line before the build.
|
||||
The bootstrap is required: CI checks out and runs this alone, and
|
||||
`script/fmt-check` runs the formatter on the host.
|
||||
`docker build --build-arg VERSION="$version" -t "$tag" .` (what CI runs),
|
||||
with `$version` from `git describe --tags --always --dirty` (`unknown` if
|
||||
empty) and `$tag` from `script/projectname`, each assigned on its own line
|
||||
before the build. The bootstrap is required: CI checks out and runs this
|
||||
alone, and `script/fmt-check` runs the formatter on the host.
|
||||
- [ ] `script/bootstrap`, `script/fmt` and `script/fmt-check` run yarn by
|
||||
whichever name is present: `yarn`, or `yarnpkg` on Debian and Ubuntu. With
|
||||
neither name on `PATH`, `script/fmt` and `script/fmt-check` print one line
|
||||
@@ -279,14 +261,7 @@ are thin shims calling them. Model scripts:
|
||||
- [ ] `script/cibuild` succeeds in a fresh clone on a host carrying what CI has.
|
||||
That host is the runner image
|
||||
`docker.gitea.com/runner-images:ubuntu-latest`, which has docker, git and
|
||||
node 24. Take any yarn off `PATH` first. The run must show that the checks
|
||||
executed. A sub-second build means nothing ran. So does `CACHED` on a step
|
||||
that lints or tests, one of the `RUN` steps below `ARG CACHEBUST`. Above
|
||||
that line, these steps are expected to show `CACHED`:
|
||||
- the steps that install system packages
|
||||
- the steps that download Go's modules
|
||||
- the step that runs `script/bootstrap` to install a Python `test` phase's
|
||||
packages from `Pipfile.lock`
|
||||
node 24. Take any yarn off `PATH` first.
|
||||
- [ ] Plant a lint violation and confirm both `make lint` and a plain
|
||||
`docker build .` fail on it; revert. A plain build that passes proves the
|
||||
final stage is missing its `COPY --from=` edge to the gate phases.
|
||||
|
||||
Reference in new issue
Block a user