Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…e-task-step-plugin into retry-JENKINS-49707
  • Loading branch information
jglick committed Jul 22, 2022
2 parents 8d39d15 + 02b9244 commit 2e95e3a
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 6 deletions.
9 changes: 4 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
</pluginRepositories>
<properties>
<changelist>999999-SNAPSHOT</changelist>
<jenkins.version>2.332.1</jenkins.version>
<jenkins.version>2.346.1</jenkins.version>
<useBeta>true</useBeta>
<gitHubRepo>jenkinsci/${project.artifactId}-plugin</gitHubRepo>
<hpi.compatibleSinceVersion>2.40</hpi.compatibleSinceVersion>
Expand All @@ -75,7 +75,7 @@
<dependencies>
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-2.332.x</artifactId>
<artifactId>bom-2.346.x</artifactId>
<version>1478.v81d3dc4f9a_43</version>
<scope>import</scope>
<type>pom</type>
Expand All @@ -86,6 +86,7 @@
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-step-api</artifactId>
<version>639.v6eca_cd8c04a_a_</version> <!-- TODO until in BOM -->
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
Expand All @@ -102,13 +103,12 @@
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-cps</artifactId>
<version>2725.v7b_c717eb_12ce</version> <!-- TODO https://github.com/jenkinsci/bom/pull/1187 -->
<version>2759.v87459c4eea_ca_</version> <!-- TODO until in BOM -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-job</artifactId>
<version>1186.v8def1a_5f3944</version> <!-- TODO https://github.com/jenkinsci/bom/pull/1187 -->
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -146,7 +146,6 @@
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>script-security</artifactId>
<version>1172.v35f6a_0b_8207e</version> <!-- TODO until in BOM -->
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,11 @@ public static final class QueueTaskCancelled extends CauseOfInterruption {
return;
}
listener.getLogger().println("Agent " + node.getNodeName() + " was deleted; cancelling node body");
body.cancel(new RemovedNodeCause()); // TODO pass actualInterruption=false https://github.com/jenkinsci/workflow-cps-plugin/blob/f642ed4fad556e100394ebb1f69f0ac8e5336248/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsBodyExecution.java#L251
if (Util.isOverridden(BodyExecution.class, body.getClass(), "cancel", Throwable.class)) {
body.cancel(new FlowInterruptedException(Result.ABORTED, false, new RemovedNodeCause()));
} else { // TODO remove once https://github.com/jenkinsci/workflow-cps-plugin/pull/570 is widely deployed
body.cancel(new RemovedNodeCause());
}
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,31 @@ public static final class HangStep extends Step {
});
}

@Test public void retryUnconditionally() throws Throwable {
sessions.then(r -> {
Slave s = inboundAgents.createAgent(r, "dumbo1");
s.setLabelString("dumb");
r.jenkins.updateNode(s);
WorkflowJob p = r.createProject(WorkflowJob.class, "p");
p.setDefinition(new CpsFlowDefinition(
"retry(2) {\n" +
" node('dumb') {\n" +
" if (isUnix()) {sh 'sleep 10'} else {bat 'echo + sleep && ping -n 10 localhost'}\n" +
" }\n" +
"}", true));
WorkflowRun b = p.scheduleBuild2(0).waitForStart();
r.waitForMessage("+ sleep", b);
inboundAgents.stop("dumbo1");
r.jenkins.removeNode(s);
r.waitForMessage("Retrying", b);
s = inboundAgents.createAgent(r, "dumbo2");
s.setLabelString("dumb");
r.jenkins.updateNode(s);
r.waitForMessage("Running on dumbo2 in ", b);
r.assertBuildStatusSuccess(r.waitForCompletion(b));
});
}

@Test public void overallBuildCancelIgnored() throws Throwable {
sessions.then(r -> {
r.createSlave(Label.get("remote"));
Expand Down

0 comments on commit 2e95e3a

Please sign in to comment.