Skip to content
Permalink
Browse files

Merge pull request #265 from jglick/parallel-JENKINS-29413

[JENKINS-29413] Hung build when running the parallel step with an empty map
  • Loading branch information...
jglick committed Dec 6, 2015
2 parents be558db + 1ecc56e commit 85330f60060d84c9d4d5b05a2062e9fc97063a74
@@ -2,6 +2,10 @@

Only noting significant user changes, not internal code cleanups and minor bug fixes.

## 1.12 (upcoming)

* [JENKINS-29413](https://issues.jenkins-ci.org/browse/JENKINS-29413): hung build when running the `parallel` step with an empty map.

## 1.12-beta-2 (Nov 25 2015)

* [JENKINS-29705](https://issues.jenkins-ci.org/browse/JENKINS-29705): added _Thread Dump_ link to running flow builds for diagnosing problems like hangs.
@@ -401,6 +401,17 @@ public void invisibleParallelBranch() throws Exception {
});
}

@Issue("JENKINS-29413")
@Test public void emptyMap() {
story.addStep(new Statement() {
@Override public void evaluate() throws Throwable {
p = jenkins().createProject(WorkflowJob.class, "demo");
p.setDefinition(new CpsFlowDefinition("parallel [:]", true));
story.j.assertBuildStatusSuccess(p.scheduleBuild2(0));
}
});
}

@Test
@Issue("JENKINS-26122")
public void parallelBranchLabels() {
@@ -1,6 +1,7 @@
package org.jenkinsci.plugins.workflow.cps.steps;

import groovy.lang.Closure;
import hudson.model.TaskListener;
import org.jenkinsci.plugins.workflow.actions.LabelAction;
import org.jenkinsci.plugins.workflow.actions.ThreadNameAction;
import org.jenkinsci.plugins.workflow.cps.CpsStepContext;
@@ -13,6 +14,7 @@

import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map.Entry;

@@ -37,6 +39,12 @@ public ParallelStepExecution(ParallelStep parallelStep, StepContext context) {
@Override
public boolean start() throws Exception {
CpsStepContext cps = (CpsStepContext) getContext();
if (parallelStep.closures.isEmpty()) {
cps.get(TaskListener.class).getLogger().println("No branches to run");
cps.onSuccess(Collections.<String,Object>emptyMap());
return true;
}

CpsThread t = CpsThread.current();

ResultHandler r = new ResultHandler(cps, this, parallelStep.isFailFast());

0 comments on commit 85330f6

Please sign in to comment.
You can’t perform that action at this time.