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
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:
1 parent
435be63ae0
commit
eebd6ca697
5 files changed
+109
-31
No files matched your search
@@ -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
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
* **Creation**: [publish-image.yml](../.gitea/workflows/publish-image.yml) - a `vX.Y.Z` tag push builds `Dockerfile` on the arm64 runner and pushes `registry.noelsabia.dev/cv_website/nuxt` as the version and `sha-<12>`, plus `latest` when that tag is the newest release. Main pushes deliberately do not build: the registry holds releases, not commits. The job uses the runner's own Docker daemon (client only in the `node:22-bookworm` container), so the act_runner needs `container.docker_host: automount`; the first step fails with that cause if it is missing. That socket is root-equivalent, so it may only sit on a label PR jobs cannot use - recorded under the trust boundary in [Publishing images to the own registry](decisions/registry-publishing.md). Repo secrets: `REGISTRY_USERNAME`, `REGISTRY_PASSWORD`.
|
||||
* **Review follow-up** (PR #19, 1 BLOCKER + 4 WARN + 2 NIT): applied the strict `vMAJOR.MINOR.PATCH` check, the newest-release rule for `latest`, a smoke test that starts the image and requires 2xx on `/`, and `timeout-minutes: 20`. Rejected with evidence: the `.dockerignore` leak (`.env*`, `*.pem`, `.git` are excluded) and the Docker-client/daemon API mismatch (20.10.24 client against a 29.9.2 daemon built successfully over the socket).
|
||||
* **Second review follow-up** (PR #19): the job now runs on the dedicated `publish` label instead of `ubuntu-latest`, so the host socket it needs can never be shared with PR jobs - the earlier version required a runner configuration its own trust boundary forbade. Added the immutability guard (registry v2 `manifests/<version>`: `200` aborts, `404` continues) after measuring that `docker manifest inspect` fails on OCI indexes with the pinned 20.10 client; the smoke test now also requires a rendered body (10 kB floor) rather than a bare 2xx. `.github/actionlint.yaml` declares the custom label, and the hook passes it with `-config-file` because this repo keeps workflows in `.gitea/`.
|
||||
|
||||
## 2026-10-23 (PR #16 review checked, three findings applied)
|
||||
* **Update**: [pr-checker.yml](../.gitea/workflows/pr-checker.yml) - the review prompt now states that `pnpm-lock.yaml` is excluded from `.pr-review-diff.patch` on purpose. The reviewer read the exclusion as an uncommitted lockfile and raised a false BLOCKER; the lockfile is in the PR and matches `package.json`.
|
||||
|
||||
Reference in new issue
Block a user