jenkinsci / ec2-fleet-plugin

The EC2 Fleet plugin launches EC2 instances as worker nodes for Jenkins CI server, automatically scaling the capacity with the load.
https://plugins.jenkins.io/ec2-fleet/
Apache License 2.0
111 stars 81 forks source link

Resubmitting last unsuccessful build instead of last failed build #451

Closed ItielOlenick closed 1 month ago

ItielOlenick commented 1 month ago

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 locally

Submitter checklist