-
Notifications
You must be signed in to change notification settings - Fork 271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mark last instance unhealthy if BuildkiteTerminateInstanceAfterJob
is enabled
#1245
Merged
Commits on Oct 20, 2023
-
Correctly terminate single-job instances
There's a situation that can occur when using the TerminateAfterJob mode of the agent, where when the ASG gets down to its MinSize, after running a job, the agent will attempt to self-terminate using the `aws autoscaling terminate-instance-in-autoscaling-group` command, but becuase that action would cause the ASG to go below its minsize, the call fails. This fails the entire systemd `ExecPostStop` hook, which fails the entire unit, which causes systemd to restart the unit. This means that in certain circumstances (when the instance attempted to self-terminate but the call failed), single-job instances can be caused to retain state from previous jobs, which is the opposite of what we want for these instances. This PR changes the autoterminate script so that if the instance is in TerminateAfterJob mode, if the call to terminate fails, the instance will call `shutdown` on itself, causing the instance to be removed from the ASG no matter what EC2 has to say about it
Configuration menu - View commit details
-
Copy full SHA for 4a5abec - Browse repository at this point
Copy the full SHA 4a5abecView commit details -
Configuration menu - View commit details
-
Copy full SHA for 7eec130 - Browse repository at this point
Copy the full SHA 7eec130View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4e95386 - Browse repository at this point
Copy the full SHA 4e95386View commit details -
Configuration menu - View commit details
-
Copy full SHA for 11a5832 - Browse repository at this point
Copy the full SHA 11a5832View commit details -
Configuration menu - View commit details
-
Copy full SHA for 916dfe1 - Browse repository at this point
Copy the full SHA 916dfe1View commit details -
Also set BUILDKITE_TERMINATE_INSTANCE_AFTER_JOB in cfn-env
Then it will appear in the job logs, so customers will know it is set by the elastic stack.
Configuration menu - View commit details
-
Copy full SHA for cee477c - Browse repository at this point
Copy the full SHA cee477cView commit details -
Use systemd service overrides instead of systemctl set-env
The latter affects every subsequently started service (at least). The former only affects the service that needs the env variable.
Configuration menu - View commit details
-
Copy full SHA for f05546d - Browse repository at this point
Copy the full SHA f05546dView commit details -
Configuration menu - View commit details
-
Copy full SHA for d9fe204 - Browse repository at this point
Copy the full SHA d9fe204View commit details -
Configuration menu - View commit details
-
Copy full SHA for f9d7731 - Browse repository at this point
Copy the full SHA f9d7731View commit details -
Configuration menu - View commit details
-
Copy full SHA for d2927cf - Browse repository at this point
Copy the full SHA d2927cfView commit details
Commits on Oct 22, 2023
-
Modify terminate-instance on windows to stop the agent earlier, but r…
…estart it if needed
Configuration menu - View commit details
-
Copy full SHA for c3ebaa5 - Browse repository at this point
Copy the full SHA c3ebaa5View commit details -
Configuration menu - View commit details
-
Copy full SHA for 5b02d95 - Browse repository at this point
Copy the full SHA 5b02d95View commit details
Commits on Oct 23, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 198db6e - Browse repository at this point
Copy the full SHA 198db6eView commit details
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.