diff --git a/src/main/java/com/amazon/jenkins/ec2fleet/EC2FleetAutoResubmitComputerLauncher.java b/src/main/java/com/amazon/jenkins/ec2fleet/EC2FleetAutoResubmitComputerLauncher.java index f23d9543..c286e837 100644 --- a/src/main/java/com/amazon/jenkins/ec2fleet/EC2FleetAutoResubmitComputerLauncher.java +++ b/src/main/java/com/amazon/jenkins/ec2fleet/EC2FleetAutoResubmitComputerLauncher.java @@ -102,7 +102,7 @@ public void afterDisconnect(final SlaveComputer computer, final TaskListener lis final List actions = new ArrayList<>(); if (task instanceof WorkflowJob) { - final WorkflowRun failedBuild = ((WorkflowJob) task).getLastFailedBuild(); + final WorkflowRun failedBuild = ((WorkflowJob) task).getLastUnsuccessfulBuild(); actions.addAll(failedBuild.getActions(ParametersAction.class)); } if (executable instanceof Actionable) { diff --git a/src/test/java/com/amazon/jenkins/ec2fleet/EC2FleetAutoResubmitComputerLauncherTest.java b/src/test/java/com/amazon/jenkins/ec2fleet/EC2FleetAutoResubmitComputerLauncherTest.java index 06974bf6..6cf4631d 100644 --- a/src/test/java/com/amazon/jenkins/ec2fleet/EC2FleetAutoResubmitComputerLauncherTest.java +++ b/src/test/java/com/amazon/jenkins/ec2fleet/EC2FleetAutoResubmitComputerLauncherTest.java @@ -189,7 +189,7 @@ public void taskCompleted_should_resubmit_task_with_actions() { @Test public void taskCompleted_should_resubmit_task_with_failed_build_actions() { when(subTask1.getOwnerTask()).thenReturn(workflowJob); - when(workflowJob.getLastFailedBuild()).thenReturn(workflowRun); + when(workflowJob.getLastUnsuccessfulBuild()).thenReturn(workflowRun); when(workflowRun.getActions(any())).thenReturn((Collections.singletonList(action1))); when(computer.getExecutors()).thenReturn(Arrays.asList(executor1)); new EC2FleetAutoResubmitComputerLauncher(baseComputerLauncher)