ci(docker): the prune counts the docker job by suffix, so #2219's rename no longer disables it #2231

Merged
jaylouisw merged 2 commits from ci/1120-0027 into main 2026-11-20 01:08:03 +00:00
Owner

What was broken

Bound what the build left behind (ci.yml, docker job) only runs docker builder prune --keep-storage 2GB when no other image build is sharing the host daemon. It answers
"how many builds are running" from /actions/tasks?status=running with

.filter((t) => t.name === "Docker build").length

#2219 merged the smoke test into that job and renamed it Server smoke and Docker build. After the rename the equality matches no task at all, this job included,
so the count is 0 on every run, the 0|1) case reads 0 as "alone", and the prune
runs even when another build is using the cache it is about to drop.

Evidence (/api/v1/repos/jaylouisw/packetforge/actions/tasks, 2026-11-20T00:30Z):

  • 25 docker tasks since the rename at 22:41Z (task 21234 onward; e.g. task 21319,
    run 8060, Server smoke and Docker build), 6 still named Docker build because
    older pull requests run the ci.yml they branched from.
  • the equality matches 0 of the 19 renamed tasks; a suffix match matches 19.
  • 7 of the 25 overlapped a sibling docker task on the same daemon — each of those is
    a prune under a live build, the race that failed runs 7378, 7762, 7883 and 7887
    with failed to export image: ... unknown parent image ID and reddened main.

The change

One expression and its comment: match /(Docker build)$/ instead of equality, so this
job is counted whichever of the two names it carries (and pull requests on the old
ci.yml are still counted as siblings). An empty list now reports unknown instead of
0 — with this job's own task always in the list, "no build running" cannot be true,
so the safe reading is the current skip-the-prune branch, not "alone".

Measured

Same snippet, three real payload shapes:

tasks running before after
this job + a test leg 0 → prune 1 → prune
this job + a second docker build 0 → prune (bug) 2 → skip
this job + an old-named Docker build 1 → prune (bug) 2 → skip

Before run: 8060 (task 21319, Server smoke and Docker build, prune ran with the
counter reading 0). After: this pull request's own docker job, where the counter now
sees its own task.

Coverage

Unchanged: no job removed, no step skipped differently, no check weakened, no timeout
touched. The only behavioural difference is when the 2 GB cache bound runs: never
while another build is using that cache, which is what the step already intended.
node scripts/check-ci-disk-hygiene.js and node --test test/ci-disk-hygiene.test.js
(12/12) pass with the change.

## What was broken `Bound what the build left behind` (ci.yml, docker job) only runs `docker builder prune --keep-storage 2GB` when no other image build is sharing the host daemon. It answers "how many builds are running" from `/actions/tasks?status=running` with ```js .filter((t) => t.name === "Docker build").length ``` #2219 merged the smoke test into that job and renamed it `Server smoke and Docker build`. After the rename the equality matches **no task at all**, this job included, so the count is `0` on every run, the `0|1)` case reads `0` as "alone", and the prune runs even when another build is using the cache it is about to drop. Evidence (/api/v1/repos/jaylouisw/packetforge/actions/tasks, 2026-11-20T00:30Z): * 25 docker tasks since the rename at 22:41Z (task 21234 onward; e.g. task 21319, run 8060, `Server smoke and Docker build`), 6 still named `Docker build` because older pull requests run the ci.yml they branched from. * the equality matches 0 of the 19 renamed tasks; a suffix match matches 19. * 7 of the 25 overlapped a sibling docker task on the same daemon — each of those is a prune under a live build, the race that failed runs 7378, 7762, 7883 and 7887 with `failed to export image: ... unknown parent image ID` and reddened main. ## The change One expression and its comment: match `/(Docker build)$/` instead of equality, so this job is counted whichever of the two names it carries (and pull requests on the old ci.yml are still counted as siblings). An empty list now reports `unknown` instead of `0` — with this job's own task always in the list, "no build running" cannot be true, so the safe reading is the current skip-the-prune branch, not "alone". ## Measured Same snippet, three real payload shapes: | tasks running | before | after | |---|---|---| | this job + a test leg | 0 → prune | 1 → prune | | this job + a second docker build | 0 → prune (bug) | 2 → skip | | this job + an old-named `Docker build` | 1 → prune (bug) | 2 → skip | Before run: 8060 (task 21319, `Server smoke and Docker build`, prune ran with the counter reading 0). After: this pull request's own docker job, where the counter now sees its own task. ## Coverage Unchanged: no job removed, no step skipped differently, no check weakened, no timeout touched. The only behavioural difference is *when* the 2 GB cache bound runs: never while another build is using that cache, which is what the step already intended. `node scripts/check-ci-disk-hygiene.js` and `node --test test/ci-disk-hygiene.test.js` (12/12) pass with the change.
ci(docker): count every docker-build job by suffix, so the prune waits again (#2231)
Some checks failed
CI / Classify the change (pull_request) Successful in 14s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 12s
CI / Server smoke and Docker build (pull_request) Failing after 23s
CI / Test (Node 22) (pull_request) Successful in 55s
CI / Test (Node 20) (pull_request) Successful in 57s
CI / Test (Node 18) (pull_request) Successful in 1m0s
CI / Arm auto-merge (pull_request) Successful in 4s
a695246344
#2219 merged the smoke test into the image build and named the job
`Server smoke and Docker build`. The cleanup's busy counter compared the
task name for equality with `Docker build`, so after that rename it matched
no running task at all - this job included. The count read 0 on every run,
the 0|1 case reads 0 as "alone", and the 2 GB builder prune ran regardless
of what else was building against the same host daemon.

Measured 2026-11-20T00:30Z (/actions/tasks): 25 docker tasks since the
rename, 6 still named `Docker build` (pull requests running the older
ci.yml) and 19 named `Server smoke and Docker build`; the equality matches
none of the 19, and 7 of the 25 shared the daemon with another build - each
of those pruned under a live build, which is the race that failed runs 7378,
7762, 7883 and 7887 with `unknown parent image ID`.

Both names end in `Docker build`, so a suffix match counts this job
whichever name it carries; an empty list is now the unreadable case and
skips the prune, rather than reading as "alone".
ci(docker): a comment inside the single-quoted node -e cannot carry an apostrophe (#2231)
All checks were successful
CI / Classify the change (pull_request) Successful in 8s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 11s
CI / Test (Node 20) (pull_request) Successful in 1m0s
CI / Test (Node 18) (pull_request) Successful in 1m4s
CI / Test (Node 22) (pull_request) Successful in 1m0s
CI / Server smoke and Docker build (pull_request) Successful in 39s
CI / Arm auto-merge (pull_request) Successful in 7s
d33b75ae6e
Run 8065, task 21334 (`Server smoke and Docker build`, 23 s, red): the
cleanup step is a `node -e '...'` heredoc-less one-liner, so the apostrophe
in "this job's own task" closed the shell quote and the step died on a bash
syntax error - `bash -n` on the step now passes and the block's own JS
still parses. Same intent, one word changed.
Author
Owner

Red leg is real, and it is one character. Server smoke and Docker build fails on a6952463 with

/var/run/act/workflow/7.sh: line 78: syntax error near unexpected token `{'

The node -e '...' block is a single-quoted shell string, and the added comment line

// job's own task in it, "no Docker build running" cannot be true.

carries an apostrophe in job's. It closes the shell string early, so the { in if (!builds.length) { ... } is parsed by bash, not node — exactly the reported token. The block in main has no ' inside it and runs clean; this is the only one introduced.

Fix is to drop the apostrophe (// this job has its own task in the list, so an empty result etc.) — no logic change. I did not touch .forgejo/workflows/: that file is the ci loop's to change, and this run's action was merges. The other six legs of a6952463 are green (18/20/22, smoke, classify, rebase), so it should go green on a push of that one-line comment edit.

**Red leg is real, and it is one character.** `Server smoke and Docker build` fails on `a6952463` with ``` /var/run/act/workflow/7.sh: line 78: syntax error near unexpected token `{' ``` The `node -e '...'` block is a single-quoted shell string, and the added comment line ``` // job's own task in it, "no Docker build running" cannot be true. ``` carries an apostrophe in `job's`. It closes the shell string early, so the `{` in `if (!builds.length) { ... }` is parsed by bash, not node — exactly the reported token. The block in main has no `'` inside it and runs clean; this is the only one introduced. Fix is to drop the apostrophe (`// this job has its own task in the list, so an empty result` etc.) — no logic change. I did not touch `.forgejo/workflows/`: that file is the ci loop's to change, and this run's action was merges. The other six legs of `a6952463` are green (18/20/22, smoke, classify, rebase), so it should go green on a push of that one-line comment edit.
forgejo-actions scheduled this pull request to auto merge when all checks succeed 2026-11-20 00:43:42 +00:00
jaylouisw deleted branch ci/1120-0027 2026-11-20 01:08:06 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jaylouisw/packetforge!2231
No description provided.