Clean up as much as possible in a single pass for the EphemeralRunner reconciler #3941
+106
−102
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.
In addition to cleaning up as many resources as possible in a single pass on the ephemeral runner reconciler, an additional check has been added to check if the container has a hook configured.
The check goes through the runner's environment variables and looks for
ACTIONS_RUNNER_CONTAINER_HOOKS
.Previously, the controller would always check if there were leftover resources linked to the runner. This check is not necessary when the container hook is not configured.
Also, it is important to point out that in most cases, there will be no resources linked to the runner, unless the runner is forcefully terminated without having a chance to call the hook to clean them up. Nevertheless, the only way to configure the container hook for the runner is to pass the
ACTIONS_RUNNER_CONTAINER_HOOKS
environment variable to the container. Unless the environment variable is baked into the custom-built runner image, the check will work as expected.