fix: create the runner's group before its account (CP-42) #22
No reviewers
Labels
No labels
needs-info
needs-triage
ready-for-agent
ready-for-human
review
merge-ready
review
needs-fix
review
needs-human
review
needs-operator
review
needs-review
review
waiting
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
olympus/infra-cockpit!22
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "hermes/cp42-runner-group"
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?
!21's deploy (run 58) failed on 145, and PROD is degraded until this merges: 143 has had
use_remote_runner: truesince 18:12:24 UTC, and no runner is registered. Any task started now errors. None has been started since the switch (checked at 18:2x: no task created after 18:12,GET /api/runnersempty).Summary
Cause. The
usermodule'sgroup:sets an account's primary group; it does not create one. 143 never hit this because the server role names no group, souseraddmakes a user-private one. On 145 nothing had madesemaphore:Why the rehearsal passed it. Under
--check, an account that does not exist yet is reported as a change without the group being looked up. The comment above the new task says so, because no--checkrun will catch a regression here.Also in this change:
role refuses a missing runner tokenunset the token only from its own list. A shell that had sourced.envpassed the real token through, so the refusal it asserts never fired. It now also doesenv -uon the inherited name.Evidence
Dockerfile.rehearsal, sshd, no init), fromorigin/mainand then from this branch:make check→ exit 0,env tests: every case passed.,plan tests: every case passed.The package fixture still reportsskip(nodpkgon the machine that ran it).SEMAPHORE_RUNNER_REGISTRATION_TOKEN=fake-inherited-token make env-test→every case passed. Before the fix, the same inherited name produced4 case(s) FAILED.make service-checkagainst 143 and 145 →semaphore ok=32 changed=1 failed=0,semaphore-runner ok=21 changed=7 failed=0.Merge Danger
Door: two-way.
Merging re-runs the deploy. The server play is a no-op on 143 (the config already carries the switch and the token), so the deploy's real work is on 145: the group and user, then everything run 58 never reached.
Blast Radius: 145, plus one
PUT /api/runners/<id>on 143.If the runner play fails further on, PROD stays where it is now: degraded, no runner. To get tasks running again without a runner, revert
semaphore_use_remote_runnertofalseand deploy.Review started (round 1/5) on
51ca3cdf94— reading the diff now.repo=olympus/infra-cockpit pr=22 head=51ca3cdf94a7d40f75532b5ba644b2d3b023e562 round=1/5 verdict=merge
Recommendation: merge
Round 1 of 5. No earlier review on this thread (
list_pull_reviewswas empty), so the whole head is reviewed against basebaa757b(git merge-base --is-ancestor baa757b 51ca3cdtrue; delta = 2 files, +17/-3).Spec: CP-42 (Vikunja project 11, index 42) plus the PR body. The PR is a follow-up fix to !21's deploy (run 58), so the contract is the body's: create the runner's group before the account that names it, and make the refusal test independent of an inherited token.
Standards:
AGENTS.md(read at head). §Toolchain: "make checkis the one command that needs no credential"; §Pull requests: name the task asCP-<index>. Nodocs/adr/in this repo; no other written convention bears on the diff.Standards
No BLOCKER.
semaphore/service/roles/semaphore_runner/tasks/main.yml:146— nothing inmake checkpins the new group task. The comment atmain.yml:140-145says no--checkrun catches this regression, so a deterministic guard is the only thing that would. The repo already has the shape for it:scripts/tests/run.sh:527(case_the_third_play_runs_the_runner_default_file) and:588(case_the_runner_play_runs_the_token_mode_file) read--list-tasksfor a task by name and for its order. Evidence (mutation): I deleted thesystem group for the runnertask at head and ranmise exec -- make check→ rc=0, 0 FAIL lines. The next edit to this block can drop the group and go green, which is the failure that put PROD in its current state. Clearing change: one case assertingsemaphore_runner : system group for the runnerappears in play #2 beforesemaphore_runner : system user for the runner, no shell, no password(the head's--list-taskslists them at positions 70 and 71 of the log).Spec
No BLOCKER. Both claims reproduced:
ansible/modules/user.py:753(the installed module) isfail_json(msg="Group %s does not exist" % self.group);userwithgroup:sets the primary group and does not create it. The newansible.builtin.grouptask (main.yml:146-149,system: true, same{{ semaphore_runner_group }}variable the user task uses at:153) sits directly above the user task (:151) in section 2, before any task that uses the group (:164,:178, …). It is idempotent by construction (groupis a no-op when the group exists), so the same task is safe on 143-style guests where a package already made it.scripts/tests/run.sh:276and:293addenv -u SEMAPHORE_RUNNER_REGISTRATION_TOKEN. Red/green pair, run by me withSEMAPHORE_RUNNER_REGISTRATION_TOKEN=fake-inherited-token make env-test: basebaa757b→ rc=2,env tests: 4 case(s) FAILED; head → rc=0,env tests: every case passed.The author's "4 case(s) FAILED before" is exact. Clean-environmentmake env-testpasses at base and head.Verified by hand
ls-remote refs/pull/22/head, before and after the probes)51ca3cdf…both timesmise exec -- make checkat headtofu fmtall pass)ansible-playbook … site.yml --syntax-check,--list-tasksat headmake checkgit status --porcelainat head after all probessuccess, 2 contexts (plan / guest-plan-check green, second context also success)Not verified
user.py:753) and the task order in the playbook. The fix is small and the module semantics are as the body states.Named, not charged
run.sh) rides in the same PR as the role fix. The body discloses it under "Also in this change"; it is small and tied to the same CP-42 work, so it is not counted.PUT /api/runners/<id>on 143, and the revert path (semaphore_use_remote_runner: false). Consistent with the diff; nothing in the diff touches 143's config.Summary
make checkcase pins the group task (main.yml:146)The change does what it says, breaks nothing I could find, and
make checkis green. One advisory travels as advice, and the count (1) does not trip the volume rule. Merge.