You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Keep the pod of a runner that has not recorded its ID during set cleanup - #4683
Since #4681, a runner pod can start before EphemeralRunner.Status.RunnerID is recorded. Set cleanup could call RemoveRunner(0). If the service returned success or NotFound, it could then drop the registration finalizer and delete a busy runner's pod. The reproducer models that response; the live service's response to ID 0 has not been established.
Fix
Skip non-terminal ID-0 runners until their ID appears or they reach one minute old. Requeue and hold the applied spec revision while waiting; completed runners do not wait.
After the grace period, request deletion with the registration finalizer intact. Finalization recovers the real ID, reads pod state directly from Kubernetes, and checks with Actions before deleting a live pod. Busy means keep the pod and retry in 30s; other errors retry without dropping protection.
Validate positive IDs before initial publication and during cleanup. Regenerate invalid JIT data only when a direct read confirms no pod exists; otherwise retain the pod and secret for repair.
Resolve Actions credentials lazily, at most once per set-cleanup or finalizer reconcile. Finalizer name lookup and removal share the same client; later retries resolve it afresh. Credential failures do not block independent local zero-ID deletion requests.
Bounded wait, then deletion with finalizer protection; never removes ID 0
Registered runner with a reported job
Asks the service
Skips without a removal call
Finalizer, completed job
Synchronous removal
No call when already self-deregistered
Finalizer, stopped/missing pod
Synchronous removal
Confirms pod state, then queues removal
Finalizer, live pod
Synchronous removal; 30s retry if busy
Same busy guard, with ID recovery when needed
Cost and limits
Normal successful job completion and valid registration paths gain no additional network calls from identity validation or client reuse. Guarded finalization adds a direct Kubernetes pod read and, for live pods, a synchronous Actions call. Slow calls can occupy shared reconcile workers and indirectly delay provisioning; this has not been production-load benchmarked. Spec updates pause scaling while waiting for ID publication. One minute bounds the ID grace period, not total cleanup time. Invalid identity metadata may require repair, and this cannot prevent Kubernetes from terminating pods already being deleted.
Coverage
Regressions cover delayed ID/job publication, malformed identities and repair, stale caches, API/credential failures, busy/NotFound replies, and single credential resolution per finalizer retry. New regressions fail before their fixes; focused coverage passes 20 repetitions. All 33 targeted runner creation/finalization envtest cases pass after the latest change; the broader 75-case runner/set coverage passed on the preceding revision. Build and static analysis pass. These model pod state and service replies, not a live Actions job.
Since #4681 the runner controller records the runner ID only after the pod
exists, so a runner can be executing a job while its status still says 0.
Set cleanup asked the service to remove runner 0, took NotFound as success,
and deleted the runner, which deleted its live pod.
Set cleanup now never asks about ID 0. It waits up to a minute for the ID to
be recorded, holding the applied revision on a spec update, and deletes the
runner directly after that. The runner finalizer asks the service to remove
the registration before deleting a live pod, and requeues in 30s while the
runner is still executing a job.
Co-authored-by: Copilot App <[email protected]>
Protects live pods during deregistration. Review note: terminal pod phases can bypass container-state checks and remove an active runner (critical, 2 votes).
Check container termination before bypassing the live-pod service guard, and apply the zero-ID grace period before skipping runners with reported jobs.
Co-authored-by: Copilot App <[email protected]>
Reject malformed and non-positive registration IDs, read authoritative pod state before releasing finalizer protection, and resolve Actions credentials only when set cleanup needs a service removal.
Cover identity repair, stale caches, client failures, terminal runners, and busy/error/NotFound responses through the real reconcilers.
Co-authored-by: Copilot App <[email protected]>
When the status ID is zero and the JIT Secret is absent, registeredRunnerID already resolves an Actions client at line 1123 to look up the registration. If that lookup finds an ID and this pod is live, this line resolves the credentials a second time in the same reconcile, contrary to the PR's at-most-once guarantee; the second read can also fail after identity recovery succeeded and unnecessarily block finalization. Memoize the client for the finalizer reconcile or return/reuse the client used by registeredRunnerID.
Share positive-ID parsing between registration and finalization. Preserve an invalid JIT secret if its pod exists or cannot be checked, and allow regeneration only when the pod is confirmed absent.
Resolve finalizer credentials lazily once per reconcile for both name lookup and busy-runner removal, while keeping retries fresh and completed-job paths free of credential reads.
Co-authored-by: Copilot App <[email protected]>
Pin OpenEBS to 4.6.1 and disable unused storage engines and logging components to avoid the inaccessible MinIO images. Wait for the provisioner to become ready and collect diagnostics when installation fails.
Co-authored-by: Copilot App <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
Copilot review overview
🔵 Needs a closer look
Runner deletion now coordinates Kubernetes finalizers with live Actions service state, while validation remains based on modeled service responses rather than live jobs.
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
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.
Problem
Since #4681, a runner pod can start before
EphemeralRunner.Status.RunnerIDis recorded. Set cleanup could callRemoveRunner(0). If the service returned success or NotFound, it could then drop the registration finalizer and delete a busy runner's pod. The reproducer models that response; the live service's response to ID 0 has not been established.Fix
Compared to 0.14.2
RemoveRunner(0); non-204 responses block cleanupCost and limits
Normal successful job completion and valid registration paths gain no additional network calls from identity validation or client reuse. Guarded finalization adds a direct Kubernetes pod read and, for live pods, a synchronous Actions call. Slow calls can occupy shared reconcile workers and indirectly delay provisioning; this has not been production-load benchmarked. Spec updates pause scaling while waiting for ID publication. One minute bounds the ID grace period, not total cleanup time. Invalid identity metadata may require repair, and this cannot prevent Kubernetes from terminating pods already being deleted.
Coverage
Regressions cover delayed ID/job publication, malformed identities and repair, stale caches, API/credential failures, busy/NotFound replies, and single credential resolution per finalizer retry. New regressions fail before their fixes; focused coverage passes 20 repetitions. All 33 targeted runner creation/finalization envtest cases pass after the latest change; the broader 75-case runner/set coverage passed on the preceding revision. Build and static analysis pass. These model pod state and service replies, not a live Actions job.