fix(forgejo-runner): the cache server can start #138
Labels
No labels
attention
blocked
blocker:ci-red
blocker:conflict
blocker:drill-pending
blocker:unrequested
bug
claimed
documentation
enhancement
epic
merge-next
needs-ruling
needs-triage
offsite
post-merge
ready
release
scope:bootstrap
scope:coolify
scope:db
scope:docs
scope:drill
scope:installer
scope:labels
scope:platform
scope:runner
scope:users
stale
state:addressing
state:bots-reviewing
state:building
state:needs-human
No milestone
No project
No assignees
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: heavy-duty/rig#138
Loading…
Reference in a new issue
No description provided.
Delete branch "build/135-runner-cache-dir"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Every Forgejo runner
rig forgejo-runner installcreates has its cache server disabled, silently.actions/cachedoes not work on any of them; every caching workflow re-downloads on every run.Measured on a live install:
rig's own unit hardening causes it —
ProtectHome=read-onlymakes the whole home read-only and onlyRUNNER_DIRis punched back through, but the cache server wants$HOME/.cache, which is not under it.The only evidence is one journal line, and
rig forgejo-runner statusreports the runner as healthy — #133's shape one layer down: the service is up, the work it should be doing is not happening.The obvious fix is worse than the bug
Adding the path to
ReadWritePathsalone does not work, and I only know because I tried it on the live runner before writing the patch:Three restart attempts, service down. systemd refuses to namespace a path that does not exist. A patch that only edited the unit would have traded a disabled cache for a dead runner, and a test that only grepped the unit text would have called it correct.
So both halves ship together: the directory is created at install — owned by the runner user, like
RUNNER_DIRbeside it, because a root-owned.cacheunder aUser=unit fails the same way — and the unit lists it.ProtectHome=read-onlystays. The runner supervises job containers on this box's docker socket; the cache is not a reason to widen that.Verified live, from scratch
Removed the directory and the unit, then converged:
Unit at rest:
Tests
Three checks, written before the fix. The ordering trap is the reason there are three rather than one — the comment above them records why, so nobody later "simplifies" this to a unit-only edit:
ProtectHomeProtectHome=read-onlyis unchanged — the cache is not an excuse to widen the hardeningGates
shellcheck -xsteptest/cli.shoverall on this boxmainhere, and fixed by !137 (#136). None are this branch's.I pushed once with
shellcheckred (anSC2016on a new test line) and caught it in the same breath; amended and force-pushed. Flagging it rather than letting a clean-looking history imply it was right first time.Closes #135. @andres — yours to merge or reject; I will not merge or close.Verdict: approve (head
a45d848)Driven at this head:
bash test/cli.shshellcheck -xstep (34 files, uncovered guard)USER_HOMEordering:255, long before the:404useinstall -dsits before the already-registered early-out, so existing runners pick the fix up on a re-run — matches the "converged it" evidence in the body.cachefrom the unit line, suite went 788+1FAIL on exactly that check; restoredinstall -dline, suite went 788+1FAIL on exactly that check; restoredThe substantive claim — a
ReadWritePathsentry naming a nonexistent path kills the unit at namespace setup — is documented systemd behavior, and the author measured it live on a real runner before shipping both halves together; the comment above theinstall -drecords exactly that, so the next reader doesn't "simplify" it back to a unit-only edit.ProtectHome=read-onlycorrectly stays: the runner supervises job containers on the docker socket, and the cache is not a widening reason.This is also the honest sequel to #133: the journal error was the only signal and
statusreported healthy — the !134 note now names the symptom class, this removes one instance of it.Not merging, not closing — @andres's.
Review of !138 @
a45d848— approveChecked out
build/135-runner-cache-dir, read against #135, and drove:bash test/cli.shshellcheck -x commands/forgejo-runner-install.shUSER_HOMEordering:255, long before the:407install -dand:472unitinstall -dfor.cachesits before the already-registered early-out, so a re-run picks the fix upWhy both halves must ship together
Author measured live:
ProtectHome=read-only+ReadWritePathsonly onRUNNER_DIR→ cache server cannot mkdir$HOME/.cache→ silent disable. Punching.cacheintoReadWritePathswithout creating it first makes systemd refuse the unit (Failed to set up mount namespacing) — worse than a disabled cache. The comment above theinstall -drecords that so nobody "simplifies" to a unit-only edit.Shipped:
install -d … -o "$RUNNER_USER" … "$USER_HOME/.cache"(runner-owned, not root)ReadWritePaths=${RUNNER_DIR} ${USER_HOME}/.cacheProtectHome=read-onlystays — cache is not a reason to widen home writeThe three suite checks pin both halves and the non-widening of ProtectHome. Honest sequel to #133 / !134: status looked healthy while the cache work was dead; this removes one instance of that class.
I will not merge or close. @andres — yours.
Verdict: approve (head
a45d8489)Reviewed against #135 and independently verified this exact head.
bash test/cli.shshellcheck -xgategit diff --checkThe repair has both required halves and preserves the security boundary:
$USER_HOME/.cacheis created with runner ownership;RUNNER_DIRand$USER_HOME/.cache;ProtectHome=read-onlyremains unchanged;ReadWritePaths, and the non-widening hardening;changelog.d/135.mdmatches repository convention.The placement avoids the measured systemd namespace failure when
ReadWritePathsnames a nonexistent directory, while keeping the writable surface narrow. No blocking findings.I will not merge or close.
Handoff — full panel green at
a45d848@andres — !138 is 3/3 approved at head with zero
REQUEST_CHANGES: @kimi-reviewer-andresmgsl (1486), @grok-reviewer-andresmgsl (1488), @codex-reviewer-andresmgsl (1492). Label moved tostate:needs-human.Ready for your merge decision.
Closes #135. I will not merge or close.