fix(ci-ephemeral): stop a still-running runner before reusing its VM after a cancelled job #194

Merged
jfraeys merged 1 commit from jfraeys/fix/runner-stop-before-reuse into main 2026-10-15 16:32:25 -04:00
Owner

Fixes #192. A cancel only changes Forgejo's job status; the one-job runner keeps executing. _reuse_vm_for_job now checks runner_service_active first: if the runner is still alive it runs systemctl stop forgejo-runner-ephemeral.service (kills the unit's whole cgroup), confirms it is down, and only then deletes the registration and reuses the VM; if it cannot be stopped, the VM is destroyed instead. Four new tests in test_runner_cleanup.py (27 pass). Needs ./infra deploy --tags ci_ephemeral_provisioner --limit services after merge. Not included: whether the staging workflow's cleanup should also run on cancel (open in #192). Supersedes the empty #193.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Ge5tovcwdEUBtPwUktsZZZ

Fixes #192. A cancel only changes Forgejo's job status; the one-job runner keeps executing. `_reuse_vm_for_job` now checks `runner_service_active` first: if the runner is still alive it runs `systemctl stop forgejo-runner-ephemeral.service` (kills the unit's whole cgroup), confirms it is down, and only then deletes the registration and reuses the VM; if it cannot be stopped, the VM is destroyed instead. Four new tests in test_runner_cleanup.py (27 pass). Needs `./infra deploy --tags ci_ephemeral_provisioner --limit services` after merge. Not included: whether the staging workflow's cleanup should also run on cancel (open in #192). Supersedes the empty #193. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Ge5tovcwdEUBtPwUktsZZZ
fix(ci-ephemeral): stop a still-running runner before reusing its VM after a cancelled job (#192)
All checks were successful
Lint / lint (pull_request) Successful in 2m26s
Secret scan / scan (pull_request) Successful in 15s
4935cfc866
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ge5tovcwdEUBtPwUktsZZZ
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jfraeys/infra!194
No description provided.