Fix ephemeral runner job exit and cleanup#37
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR improves the lifecycle behavior of GitHub Actions ephemeral runners by ensuring runner processes exit after their assigned job and making runner deletion idempotent when GitHub has already auto-removed the runner.
Changes:
- Invoke the Actions runner with
run.sh --onceso provider-owned ephemeral runners exit after completing one job. - Treat
404 Not Foundfrom runner delete as a successful “already removed” outcome for cleanup. - Extend regression tests to cover runner invocation args and repo/org runner deletion symmetry.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
internal/runner_provider_test.go |
Adds coverage asserting repo/org runner delete both ignore 404 and hit the expected endpoints. |
internal/module_runner_provider.go |
Implements idempotent runner deletion by allowing 204 and 404 as successful delete statuses via a shared helper. |
cmd/github-actions-runner-job/main.go |
Runs the runner with --once to ensure the process exits after a single job. |
cmd/github-actions-runner-job/main_test.go |
Adds assertions that run.sh receives --once. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
run.sh --onceso provider-owned ephemeral runners exit after their assigned jobAdversarial self-review
--ephemeral --oncecan cause GitHub to auto-remove the runner before explicit cleanup; this branch now treats runner-delete 404 as successful cleanup and tests repo/org symmetry.Verification
--onceline reverted,GOWORK=off go test ./cmd/github-actions-runner-job -run TestT915CommandRunsDynamicProviderEnvelopeThroughSidecarAndRunner -count=1fails withrun args: got "\n" want --once.GOWORK=off go test ./internal -run TestT915_GitHubRunnerClientTreatsMissingRunnerAsRemoved -count=1failed withgithub runner request returned 404 Not Found.GOWORK=off go test ./cmd/github-actions-runner-job -run TestT915CommandRunsDynamicProviderEnvelopeThroughSidecarAndRunner -count=1GOWORK=off go test ./internal -run TestT915_GitHubRunnerClientTreatsMissingRunnerAsRemoved -count=1GOWORK=off go test ./cmd/github-actions-runner-job ./internal -run 'EphemeralRunner|RunnerProvider|TestT915CommandRunsDynamicProviderEnvelopeThroughSidecarAndRunner|TestT915_GitHubRunnerClientTreatsMissingRunnerAsRemoved' -count=1\n- GREEN:GOWORK=off go build -o /tmp/github-actions-runner-job ./cmd/github-actions-runner-job\n- GREEN:GOWORK=off go test ./... -count=1\n- GREEN:git diff --check