Check builds use Docker's normal cache (closes #177)
check / check (push) Successful in 1m33s
check / check (push) Successful in 1m33s
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, re-vendoring it in one commit and planting a defect to prove a changed check are gone. The README, the Go style guide and both checklists restated those rules and are updated to match. Model: opus-5-5
This commit is contained in:
1 parent
1ad7ae14be
commit
ca36d0372c
10 files changed
+104
-269
No files matched your search
@@ -116,12 +116,10 @@ alpine. We provide:
|
||||
`script/bootstrap`, then `script/install-precommit`
|
||||
- `script/projectname` — output the project name (our own extension); used by
|
||||
`script/docker` for the image tag
|
||||
- `script/test` —
|
||||
`docker build --build-arg CACHEBUST="$(date +%s)-$$" --target test --output type=cacheonly .`,
|
||||
- `script/test` — `docker build --target test --output type=cacheonly .`,
|
||||
building the `test` phase of the `Dockerfile`, which runs
|
||||
`test/update-policy.sh`, without writing an image
|
||||
- `script/lint` —
|
||||
`docker build --build-arg CACHEBUST="$(date +%s)-$$" --target lint --output type=cacheonly .`,
|
||||
- `script/lint` — `docker build --target lint --output type=cacheonly .`,
|
||||
building the `lint` phase, which runs prettier over the markdown files,
|
||||
without writing an image
|
||||
- `script/fmt` — format all markdown files with prettier (writes; native, not in
|
||||
@@ -129,14 +127,13 @@ alpine. We provide:
|
||||
- `script/fmt-check` — check formatting (read-only; native)
|
||||
- `script/check` — run all checks: `test`, `lint`, `fmt-check` (our own
|
||||
extension); builds no image of its own
|
||||
- `script/docker` —
|
||||
`docker build --build-arg CACHEBUST="$(date +%s)-$$" --build-arg VERSION="$version" -t prompts .`,
|
||||
- `script/docker` — `docker build --build-arg VERSION="$version" -t prompts .`,
|
||||
the tag coming from `script/projectname` (byte-identical across repos)
|
||||
- `script/cibuild` — cd to the repo root, run `script/bootstrap`, run
|
||||
`script/check`, compute `version` from `git describe`, then
|
||||
`docker build --build-arg CACHEBUST="$(date +%s)-$$" --build-arg VERSION="$version" -t prompts .`
|
||||
(what CI runs; it bootstraps because CI checks out and runs this alone while
|
||||
`script/fmt-check` is native)
|
||||
`docker build --build-arg VERSION="$version" -t prompts .` (what CI runs; it
|
||||
bootstraps because CI checks out and runs this alone while `script/fmt-check`
|
||||
is native)
|
||||
- `script/precommit` — run by the git pre-commit hook (our own extension); calls
|
||||
`script/check`
|
||||
- `script/install-precommit` — installs the git pre-commit hook (our own
|
||||
@@ -147,22 +144,9 @@ alpine. We provide:
|
||||
|
||||
`make hooks` installs the pre-commit hook that runs `script/precommit`.
|
||||
|
||||
In every stage of a `Dockerfile`, 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`.
|
||||
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. This repo's own `Dockerfile` installs git, make, node and yarn right
|
||||
after `FROM` in every stage, above `ARG CACHEBUST`. `script/bootstrap` installs
|
||||
the node packages below that line, because check builds keep system packages but
|
||||
not node packages.
|
||||
The builds use Docker's normal cache: a step runs again only when its inputs
|
||||
change. This repo's own `Dockerfile` installs git, make, node and yarn right
|
||||
after `FROM` in every stage, so a change to `script/` keeps that layer.
|
||||
|
||||
## Rationale
|
||||
|
||||
|
||||
Reference in new issue
Block a user