When an agent gets disconnected (AWS interruption) the job is set to aborted.
Currently the job that gets resubmitted is the last failed job, which is not the job that was running on the agent that got disconnected, leading to the wrong parameters being used with the resubmitted job.
This fixes the issue by using getLastUnsuccessfulBuild to get the last job that ran before the agent went down.
Testing done
Unit testing with mvn test and locally
Submitter checklist
[x] Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
[x] Ensure that the pull request title represents the desired changelog entry
[x] Please describe what you did
[x] Link to relevant issues in GitHub or Jira
[ ] Link to relevant pull requests, esp. upstream and downstream changes
[x] Ensure you have provided tests - that demonstrates feature works or fixes the issue
Fixes https://github.com/jenkinsci/ec2-fleet-plugin/issues/443
When an agent gets disconnected (AWS interruption) the job is set to aborted. Currently the job that gets resubmitted is the last failed job, which is not the job that was running on the agent that got disconnected, leading to the wrong parameters being used with the resubmitted job.
This fixes the issue by using
getLastUnsuccessfulBuild
to get the last job that ran before the agent went down.Testing done
Unit testing with
mvn test
and locallySubmitter checklist