ci(runners): re-own the actions cache recursively — uid-1000 jobs die in checkout #70
3 changed files with 60 additions and 37 deletions
|
|
@ -25,6 +25,12 @@ spec:
|
|||
matchLabels:
|
||||
app: forgejo-runner
|
||||
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:
|
||||
type: Recreate
|
||||
template:
|
||||
|
|
@ -87,18 +93,20 @@ spec:
|
|||
- |
|
||||
set -e
|
||||
chown 1000:1000 /data
|
||||
# Re-own every entry the runner writes as uid 1000 — runner.ini,
|
||||
# cache/ and the actions cache .cache/act/ where it clones the
|
||||
# action repos (a stale root-owned pack file there fails the job
|
||||
# with "permission denied"). Skip `docker`, the dind data-root,
|
||||
# which stays root-owned: a recursive chown of that tree is tens
|
||||
# of GB on the Pi. The owner check makes repeat starts cheap.
|
||||
for d in /data/* /data/.[!.]*; do
|
||||
if [ ! -e "$d" ]; then continue; fi
|
||||
if [ "$d" = /data/docker ]; then continue; fi
|
||||
if [ "$(stat -c %u "$d")" != 1000 ]; then
|
||||
chown -R 1000:1000 "$d"
|
||||
fi
|
||||
# Re-own the trees the runner itself writes: runner.ini, the act
|
||||
# cache (cache/) and the action-repo checkout cache (.cache/act/).
|
||||
# The re-own MUST be recursive. A top-level owner check is exactly
|
||||
# what let this through once: /data/.cache was already 1000 while
|
||||
# the git packs inside it were still root:root from the pre-uid-1000
|
||||
# runner, so the guard skipped the one file that mattered and every
|
||||
# job died in actions/checkout before any step ran:
|
||||
# open /data/.cache/act/actions-checkout@v4/.git/objects/pack/
|
||||
# pack-<id>.pack: permission denied
|
||||
# (card t_29249bf0: 3 s red X, zero steps.) A few thousand small
|
||||
# files; the dind data-root (/data/docker, tens of GB) stays
|
||||
# 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
|
||||
true
|
||||
volumeMounts:
|
||||
|
|
|
|||
|
|
@ -12,7 +12,12 @@ spec:
|
|||
matchLabels:
|
||||
app: forgejo-runner
|
||||
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:
|
||||
type: Recreate
|
||||
template:
|
||||
|
|
@ -53,18 +58,20 @@ spec:
|
|||
- |
|
||||
set -e
|
||||
chown 1000:1000 /data
|
||||
# Re-own every entry the runner writes as uid 1000 — runner.ini,
|
||||
# cache/ and the actions cache .cache/act/ where it clones the
|
||||
# action repos (a stale root-owned pack file there fails the job
|
||||
# with "permission denied"). Skip `docker`, the dind data-root,
|
||||
# which stays root-owned: a recursive chown of that tree is tens
|
||||
# of GB on the Pi. The owner check makes repeat starts cheap.
|
||||
for d in /data/* /data/.[!.]*; do
|
||||
if [ ! -e "$d" ]; then continue; fi
|
||||
if [ "$d" = /data/docker ]; then continue; fi
|
||||
if [ "$(stat -c %u "$d")" != 1000 ]; then
|
||||
chown -R 1000:1000 "$d"
|
||||
fi
|
||||
# Re-own the trees the runner itself writes: runner.ini, the act
|
||||
# cache (cache/) and the action-repo checkout cache (.cache/act/).
|
||||
# The re-own MUST be recursive. A top-level owner check is exactly
|
||||
# what let this through once: /data/.cache was already 1000 while
|
||||
# the git packs inside it were still root:root from the pre-uid-1000
|
||||
# runner, so the guard skipped the one file that mattered and every
|
||||
# job died in actions/checkout before any step ran:
|
||||
# open /data/.cache/act/actions-checkout@v4/.git/objects/pack/
|
||||
# pack-<id>.pack: permission denied
|
||||
# (card t_29249bf0: 3 s red X, zero steps.) A few thousand small
|
||||
# files; the dind data-root (/data/docker, tens of GB) stays
|
||||
# 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
|
||||
true
|
||||
volumeMounts:
|
||||
|
|
|
|||
|
|
@ -30,6 +30,12 @@ spec:
|
|||
matchLabels:
|
||||
app: forgejo-runner
|
||||
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:
|
||||
type: Recreate
|
||||
template:
|
||||
|
|
@ -92,18 +98,20 @@ spec:
|
|||
- |
|
||||
set -e
|
||||
chown 1000:1000 /data
|
||||
# Re-own every entry the runner writes as uid 1000 — runner.ini,
|
||||
# cache/ and the actions cache .cache/act/ where it clones the
|
||||
# action repos (a stale root-owned pack file there fails the job
|
||||
# with "permission denied"). Skip `docker`, the dind data-root,
|
||||
# which stays root-owned: a recursive chown of that tree is tens
|
||||
# of GB on the Pi. The owner check makes repeat starts cheap.
|
||||
for d in /data/* /data/.[!.]*; do
|
||||
if [ ! -e "$d" ]; then continue; fi
|
||||
if [ "$d" = /data/docker ]; then continue; fi
|
||||
if [ "$(stat -c %u "$d")" != 1000 ]; then
|
||||
chown -R 1000:1000 "$d"
|
||||
fi
|
||||
# Re-own the trees the runner itself writes: runner.ini, the act
|
||||
# cache (cache/) and the action-repo checkout cache (.cache/act/).
|
||||
# The re-own MUST be recursive. A top-level owner check is exactly
|
||||
# what let this through once: /data/.cache was already 1000 while
|
||||
# the git packs inside it were still root:root from the pre-uid-1000
|
||||
# runner, so the guard skipped the one file that mattered and every
|
||||
# job died in actions/checkout before any step ran:
|
||||
# open /data/.cache/act/actions-checkout@v4/.git/objects/pack/
|
||||
# pack-<id>.pack: permission denied
|
||||
# (card t_29249bf0: 3 s red X, zero steps.) A few thousand small
|
||||
# files; the dind data-root (/data/docker, tens of GB) stays
|
||||
# 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
|
||||
true
|
||||
volumeMounts:
|
||||
|
|
|
|||
Loading…
Reference in a new issue