fix(ci): publish on a dedicated runner label, immutable version tags
PR Check / Security scan (Snyk) (pull_request) Skipped
PR Check / Lint + typecheck (pull_request) Successful in 1m6s
PR Check / Secret scan (gitleaks) (pull_request) Successful in 6s
PR Check / Dependency audit (pull_request) Successful in 9s
PR Check / Dockerfile lint (droast) (pull_request) Successful in 5s
PR Check / AI code review (opencode) (pull_request) Successful in 48s

The review's blocker was real: runs-on: ubuntu-latest is the label
pr-checker.yml uses, and the job needs a runner-wide Docker socket, so the
only working configuration violated the trust boundary in the decision
doc. The job now runs on a dedicated 'publish' label that only a second
act_runner registration (docker_host: automount) may carry.

Version tags are now immutable: before building, the registry v2 API is
asked for manifests/<version> and 200 aborts the run. docker manifest
inspect cannot do this job - the pinned Debian 20.10 client fails on OCI
indexes for existing and missing tags alike (measured).

Also: the smoke test requires a rendered body (10 kB floor) on top of the
2xx, .github/actionlint.yaml declares the custom label, and the actionlint
hook passes that config explicitly because this repo keeps workflows in
.gitea/workflows, where actionlint does not auto-discover it.
This commit is contained in:
Noel Sabia committed 2026-10-24 19:24:47 +02:00
1 parent 435be63ae0
commit eebd6ca697
5 files changed
+109 -31

No files matched your search

+29 -10
View File
@@ -73,17 +73,24 @@ this machine means Gitea's data, k3s, and the CV itself. `docker_host` is a
that runner, including PR jobs whose code comes from a branch.
Therefore the rule: **the socket only ever goes on a runner label that
PR-triggered jobs do not use.** Two acceptable layouts:
PR-triggered jobs do not use.**
* a second act_runner registration with `docker_host: automount` and a
distinct label (e.g. `publish`), used only by this workflow; or
* one runner, but this workflow moved to the dedicated label and
`pr-checker.yml` left on a label without the socket.
The workflow follows it by scheduling onto a dedicated label:
Not acceptable: adding `automount` to the single shared runner while
`pr-checker.yml` runs on it. If that is the only option, treat it as an
accepted risk and record it here - the trade is "PR code can become root on
the host" against "images can be built at all".
```yaml
runs-on: publish # NOT ubuntu-latest, which pr-checker.yml uses
```
That label only exists once a second act_runner registration is configured
with `container.docker_host: automount` and, for example,
`--labels publish:docker://node:22-bookworm`. Until then the job queues
without starting, and `timeout-minutes` does not apply to a job that never
starts - register the runner before the first release tag.
Not acceptable: adding `automount` to the shared `ubuntu-latest` runner.
That hands PR code a root-equivalent socket on the host that also runs
Gitea and k3s. If it is ever the only option, treat it as an accepted risk
and record it here rather than letting the workflow imply it.
# Why `--platform linux/arm64`
@@ -102,14 +109,26 @@ run.
Both are repo secrets. The login uses `--password-stdin` so the value never
appears in the process list or the log.
# Before the first release tag
1. Repo secrets `REGISTRY_USERNAME` and `REGISTRY_PASSWORD` exist.
2. A runner with the `publish` label exists and its config has
`container.docker_host: automount`. Without the label the job queues
forever; without the socket it fails at `Check daemon access`.
3. `pr-checker.yml` still runs on a label whose runner has no socket.
4. Namespace `cv` has an `imagePullSecret` for the same credentials.
5. `registry.noelsabia.dev` answers over HTTPS.
# Guards in the workflow
| Guard | Why |
|---|---|
| Strict `^vMAJOR.MINOR.PATCH$` check | A `v[0-9]*` prefix match accepts `v1`, `v1-anything` and `v1.2.3-rc1`, all of which are valid registry tags and would publish silently |
| `latest` only when the built tag is the highest `vX.Y.Z` in the repository | Gitea can replay any run. Without the comparison, re-running `v1.2.0` after `v1.3.0` drags `latest` backwards. A re-run of the newest tag still moves it - that release had not produced an image yet. If the tag list cannot be fetched, `latest` is skipped with a warning rather than guessed |
| Smoke test before any push | The image is started and must answer 2xx on `/` from inside the container. Build success only proves the bundle compiled. Port publishing is not usable here: the daemon binds on the host, not in the job container |
| A published version tag is never overwritten | Before building, the registry's v2 API is asked for `manifests/<version>`: `200` aborts the run, `404` continues. A replay of a released tag fails instead of silently replacing published content. `docker manifest inspect` is deliberately *not* used - the Debian 20.10 client fails it on OCI indexes with `unsupported manifest media type and no default available`, for existing and missing tags alike |
| Smoke test before any push | The image is started and must answer 2xx with at least 10 kB of rendered HTML on `/` (the real page is ~97 kB), so "200 but nothing rendered" fails too. Port publishing is not usable here: the daemon binds on the host, not in the job container |
| `timeout-minutes: 20` | A hung build would hold the capacity-1 runner and every job queued behind it |
| `.github/actionlint.yaml` | Declares the custom `publish` label, otherwise the lint hook reports it as unknown. The hook passes the file with `-config-file`, because actionlint only auto-loads it when it recognises a `.github/workflows` project |
# Costs and consequences