Repository navigation
fix(bootstrap_ec2): mark a cancelled run's commit status as an error - #36
Merged
Merged
Conversation
A cancelled run left its commit status pending, so the pull request showed the check as still running after the run was gone. The signal handler now posts error, 'Cancelled', once the instance is terminated, and waits for the post: the runner kills orphaned processes when the job ends. The handlers in bootstrap_ec2 and bootstrap_ec2_multi ran under errexit, so a nonzero wait on the child they had just stopped ended them part-way. The instance was still terminated, by the EXIT trap, but nothing after that wait ran. They now turn errexit off: every step is best effort and they end with exit 143.
4 tasks
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.
A cancelled run left its
ci/<job>commit statuspending, so the pull request showed the check as still running after the Actions run said cancelled.bootstrap_ec2's signal handler now postserrorwith the description "Cancelled", after it has terminated the instance. GitHub statuses have no cancelled state, anderroris the closest one.post_github_statusposts in the background so it never blocks a build. It gains--waitfor the handler, which is about to exit: the runner kills orphaned processes at the end of the job, and could kill the post before it is sent. The post is capped at 5 seconds, well inside the runner's 10 seconds before SIGKILL.Writing the test turned up an older bug. The signal handlers in
bootstrap_ec2andbootstrap_ec2_multiran under errexit, so a nonzerowaiton the child they had just stopped (always 143 when the cancel lands during the instance request) ended them part-way. The instance was still terminated, by the EXIT trap, so no test noticed. But nothing after thatwaitran: the status post here, and inbootstrap_ec2_multithe wait for the run's log to be written out. Both handlers now turn errexit off.I checked every other
traphandler in ci3 for the same flaw. None has it: each already setsset +e, ends risky steps with|| true, or has the step that could fail as its last.tests/cancel_teststubscurland requires every status a cancelled run posted to finish aserror. Before the fix, all five cases failed. After it, all pass, on bash 5.2 and 5.3.