From a6499bf1c2f97be372d9d192f085f8fedc2b32f6 Mon Sep 17 00:00:00 2001 From: sirius Date: Fri, 27 Nov 2026 01:08:34 -0500 Subject: [PATCH] ci(runners): re-own the actions cache recursively so uid-1000 jobs stop dying in checkout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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'). --- apps/base/forgejo/runner-amd64.yaml | 32 +++++++++++++-------- apps/base/forgejo/runner-arm64.yaml | 33 +++++++++++++--------- apps/base/forgejo/runner-deploy-arm64.yaml | 32 +++++++++++++-------- 3 files changed, 60 insertions(+), 37 deletions(-) diff --git a/apps/base/forgejo/runner-amd64.yaml b/apps/base/forgejo/runner-amd64.yaml index 82f3ec4..8f1fedc 100644 --- a/apps/base/forgejo/runner-amd64.yaml +++ b/apps/base/forgejo/runner-amd64.yaml @@ -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-.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: diff --git a/apps/base/forgejo/runner-arm64.yaml b/apps/base/forgejo/runner-arm64.yaml index 4b16820..6acbe81 100644 --- a/apps/base/forgejo/runner-arm64.yaml +++ b/apps/base/forgejo/runner-arm64.yaml @@ -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-.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: diff --git a/apps/base/forgejo/runner-deploy-arm64.yaml b/apps/base/forgejo/runner-deploy-arm64.yaml index dc759cc..0656d8c 100644 --- a/apps/base/forgejo/runner-deploy-arm64.yaml +++ b/apps/base/forgejo/runner-deploy-arm64.yaml @@ -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-.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: