Compare commits

..
Author SHA1 Message Date
9979cf5e49 Merge pull request 'ci(runners): re-own the actions cache recursively' (#70) from ci/t_29249bf0-runner-cache-reown 2026-11-27 06:08:56 +00:00
sirius
a6499bf1c2 ci(runners): re-own the actions cache recursively so uid-1000 jobs stop dying in checkout
The fix-data-perms init container guarded a chown -R behind a TOP-LEVEL owner
check (`stat -c %u /data/.cache`). /data/.cache was already 1000 while the git
pack files inside it were still root:root from the pre-uid-1000 runner, so the
guard skipped exactly the file that matters and every job on that runner died
in actions/checkout, before a single step:

  open /data/.cache/act/actions-checkout@v4/.git/objects/pack/pack-ba0cccfe….pack:
  permission denied

That is a 3 s red X with zero steps on a push (websites run 1430, card
t_29249bf0). chown the three trees the runner writes recursively instead
(cache/, .cache/, runner.ini); /data/docker stays root-owned and unwalked.

Also document the Recreate consequence: a template rollout SIGKILLs in-flight
jobs and Forgejo reports them as a plain failure with the log cut off mid-step
(sirius-growth push run 1422: 14 min red, log ending at 'Fetching the
repository').
2026-11-27 01:08:34 -05:00
3 changed files with 60 additions and 37 deletions

View file

@ -25,6 +25,12 @@ spec:
matchLabels: matchLabels:
app: forgejo-runner app: forgejo-runner
arch: amd64 arch: amd64
# RWO PVC: never two pods on one data-root. Consequence to know before you
# touch this template: a rollout SIGKILLs the job container of any run in
# flight, and Forgejo then reports that run as a plain failure with the log
# cut off mid-step (no `exitcode` line) — seen as a 14 min "failing" push on
# sirius/sirius-growth, card t_29249bf0. Land template changes while the
# runner is idle.
strategy: strategy:
type: Recreate type: Recreate
template: template:
@ -87,18 +93,20 @@ spec:
- | - |
set -e set -e
chown 1000:1000 /data chown 1000:1000 /data
# Re-own every entry the runner writes as uid 1000 — runner.ini, # Re-own the trees the runner itself writes: runner.ini, the act
# cache/ and the actions cache .cache/act/ where it clones the # cache (cache/) and the action-repo checkout cache (.cache/act/).
# action repos (a stale root-owned pack file there fails the job # The re-own MUST be recursive. A top-level owner check is exactly
# with "permission denied"). Skip `docker`, the dind data-root, # what let this through once: /data/.cache was already 1000 while
# which stays root-owned: a recursive chown of that tree is tens # the git packs inside it were still root:root from the pre-uid-1000
# of GB on the Pi. The owner check makes repeat starts cheap. # runner, so the guard skipped the one file that mattered and every
for d in /data/* /data/.[!.]*; do # job died in actions/checkout before any step ran:
if [ ! -e "$d" ]; then continue; fi # open /data/.cache/act/actions-checkout@v4/.git/objects/pack/
if [ "$d" = /data/docker ]; then continue; fi # pack-<id>.pack: permission denied
if [ "$(stat -c %u "$d")" != 1000 ]; then # (card t_29249bf0: 3 s red X, zero steps.) A few thousand small
chown -R 1000:1000 "$d" # files; the dind data-root (/data/docker, tens of GB) stays
fi # root-owned and is deliberately not walked.
for d in /data/cache /data/.cache /data/runner.ini; do
if [ -e "$d" ]; then chown -R 1000:1000 "$d"; fi
done done
true true
volumeMounts: volumeMounts:

View file

@ -12,7 +12,12 @@ spec:
matchLabels: matchLabels:
app: forgejo-runner app: forgejo-runner
arch: arm64 arch: arm64
# RWO PVC: never two pods on one data-root. # RWO PVC: never two pods on one data-root. Consequence to know before you
# touch this template: a rollout SIGKILLs the job container of any run in
# flight, and Forgejo then reports that run as a plain failure with the log
# cut off mid-step (no `exitcode` line) — seen as a 14 min "failing" push on
# sirius/sirius-growth, card t_29249bf0. Land template changes while the
# runner is idle.
strategy: strategy:
type: Recreate type: Recreate
template: template:
@ -53,18 +58,20 @@ spec:
- | - |
set -e set -e
chown 1000:1000 /data chown 1000:1000 /data
# Re-own every entry the runner writes as uid 1000 — runner.ini, # Re-own the trees the runner itself writes: runner.ini, the act
# cache/ and the actions cache .cache/act/ where it clones the # cache (cache/) and the action-repo checkout cache (.cache/act/).
# action repos (a stale root-owned pack file there fails the job # The re-own MUST be recursive. A top-level owner check is exactly
# with "permission denied"). Skip `docker`, the dind data-root, # what let this through once: /data/.cache was already 1000 while
# which stays root-owned: a recursive chown of that tree is tens # the git packs inside it were still root:root from the pre-uid-1000
# of GB on the Pi. The owner check makes repeat starts cheap. # runner, so the guard skipped the one file that mattered and every
for d in /data/* /data/.[!.]*; do # job died in actions/checkout before any step ran:
if [ ! -e "$d" ]; then continue; fi # open /data/.cache/act/actions-checkout@v4/.git/objects/pack/
if [ "$d" = /data/docker ]; then continue; fi # pack-<id>.pack: permission denied
if [ "$(stat -c %u "$d")" != 1000 ]; then # (card t_29249bf0: 3 s red X, zero steps.) A few thousand small
chown -R 1000:1000 "$d" # files; the dind data-root (/data/docker, tens of GB) stays
fi # root-owned and is deliberately not walked.
for d in /data/cache /data/.cache /data/runner.ini; do
if [ -e "$d" ]; then chown -R 1000:1000 "$d"; fi
done done
true true
volumeMounts: volumeMounts:

View file

@ -30,6 +30,12 @@ spec:
matchLabels: matchLabels:
app: forgejo-runner app: forgejo-runner
role: deploy role: deploy
# RWO PVC: never two pods on one data-root. Consequence to know before you
# touch this template: a rollout SIGKILLs the job container of any run in
# flight, and Forgejo then reports that run as a plain failure with the log
# cut off mid-step (no `exitcode` line) — seen as a 14 min "failing" push on
# sirius/sirius-growth, card t_29249bf0. Land template changes while the
# runner is idle.
strategy: strategy:
type: Recreate type: Recreate
template: template:
@ -92,18 +98,20 @@ spec:
- | - |
set -e set -e
chown 1000:1000 /data chown 1000:1000 /data
# Re-own every entry the runner writes as uid 1000 — runner.ini, # Re-own the trees the runner itself writes: runner.ini, the act
# cache/ and the actions cache .cache/act/ where it clones the # cache (cache/) and the action-repo checkout cache (.cache/act/).
# action repos (a stale root-owned pack file there fails the job # The re-own MUST be recursive. A top-level owner check is exactly
# with "permission denied"). Skip `docker`, the dind data-root, # what let this through once: /data/.cache was already 1000 while
# which stays root-owned: a recursive chown of that tree is tens # the git packs inside it were still root:root from the pre-uid-1000
# of GB on the Pi. The owner check makes repeat starts cheap. # runner, so the guard skipped the one file that mattered and every
for d in /data/* /data/.[!.]*; do # job died in actions/checkout before any step ran:
if [ ! -e "$d" ]; then continue; fi # open /data/.cache/act/actions-checkout@v4/.git/objects/pack/
if [ "$d" = /data/docker ]; then continue; fi # pack-<id>.pack: permission denied
if [ "$(stat -c %u "$d")" != 1000 ]; then # (card t_29249bf0: 3 s red X, zero steps.) A few thousand small
chown -R 1000:1000 "$d" # files; the dind data-root (/data/docker, tens of GB) stays
fi # root-owned and is deliberately not walked.
for d in /data/cache /data/.cache /data/runner.ini; do
if [ -e "$d" ]; then chown -R 1000:1000 "$d"; fi
done done
true true
volumeMounts: volumeMounts: