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

Closed
jfraeys wants to merge 0 commits from jfraeys/fix/cancelled-job-runner-reuse into main
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. Needs ./infra deploy --tags ci_ephemeral_provisioner --limit services after merge. Not included: the staging workflow's cleanup-on-cancel decision (open in #192).

🤖 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. Needs `./infra deploy --tags ci_ephemeral_provisioner --limit services` after merge. Not included: the staging workflow's cleanup-on-cancel decision (open in #192). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Ge5tovcwdEUBtPwUktsZZZ
jfraeys closed this pull request 2026-10-16 13:59:33 -04:00
All checks were successful
Staging Validation / validate (push) Successful in 13m40s
Lint / lint (pull_request) Successful in 2m21s
Staging Validation / promote (push) Successful in 7s
Secret scan / scan (pull_request) Successful in 15s

Pull request closed

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!193
No description provided.