[JENKINS-69399] Prevent offlining ec2 node if jobs in node queue #768
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.
Overview
In our current environment we have agents that are launched by the ec2-plugin that build individual Ivy/Maven Module builds. These module builds must build on the same node as their parent.
In the event that their parent node is terminated then the module can no longer be built.
To solve this in our environment we have made a small change to the EC2RetentionStrategy class that will check for items in the queue just prior to termination.
We have been using this change on multiple versions of the ec2-plugin for the last 6 years.
Changes made
This pull requests includes changes to the EC2RetentionStrategy that prior to a nodes timout checks if there are any builds in the nodes queue. If there are builds in the queue it prevents the node from timing out.
Associated ticket
JENKINS-69399
Checklist