Skip to content
Permalink
Browse files

[JENKINS-44981] Add GenericStatus.QUEUED and related logic

  • Loading branch information...
abayer committed Jun 21, 2017
1 parent 92c9ba3 commit 63fd83731918f29e5ac98080a5a0ab234bc89257
@@ -52,12 +52,12 @@
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-api</artifactId>
<version>2.17</version>
<version>2.18-20170620.195845-2</version> <!-- TODO: update to release when https://github.com/jenkinsci/workflow-api-plugin/pull/42 is merged and released -->
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-api</artifactId>
<version>2.17</version>
<version>2.18-20170620.195845-2</version> <!-- TODO: update to release when https://github.com/jenkinsci/workflow-api-plugin/pull/42 is merged and released -->
<scope>test</scope>
<classifier>tests</classifier>
</dependency>
@@ -102,7 +102,7 @@
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-durable-task-step</artifactId>
<version>2.5</version>
<version>2.13-20170621.145853-1</version> <!-- TODO: Switch to release once https://github.com/jenkinsci/workflow-durable-task-step-plugin/pull/42 is merged and released -->
<scope>test</scope>
</dependency>
</dependencies>
@@ -45,6 +45,11 @@
*/
UNSTABLE,

/**
* Not complete: still executing, in a node block, but the node block is in queue.
*/
QUEUED,

/**
* Not complete: still executing, waiting for a result
*/
@@ -32,9 +32,11 @@
import hudson.model.Result;
import org.apache.commons.lang.StringUtils;
import org.jenkinsci.plugins.workflow.actions.ErrorAction;
import org.jenkinsci.plugins.workflow.actions.ExecutorTaskInfoAction;
import org.jenkinsci.plugins.workflow.actions.NotExecutedNodeAction;
import org.jenkinsci.plugins.workflow.actions.ThreadNameAction;
import org.jenkinsci.plugins.workflow.actions.TimingAction;
import org.jenkinsci.plugins.workflow.cps.nodes.StepStartNode;
import org.jenkinsci.plugins.workflow.flow.FlowExecution;
import org.jenkinsci.plugins.workflow.graph.BlockEndNode;
import org.jenkinsci.plugins.workflow.graph.BlockStartNode;
@@ -172,10 +174,27 @@ public static GenericStatus computeChunkStatus(@Nonnull WorkflowRun run,
return (lastNode.getError() == null) ? GenericStatus.SUCCESS : GenericStatus.FAILURE;
}
}

if (lastNode instanceof StepStartNode) {
ExecutorTaskInfoAction execAction = lastNode.getAction(ExecutorTaskInfoAction.class);
if (execAction != null) {
if (execAction.isQueued()) {
return GenericStatus.QUEUED;
} else if (execAction.isCanceled()) {
return GenericStatus.ABORTED;
} else {
return GenericStatus.IN_PROGRESS;
}
}
}

PauseAction pauseAction = lastNode.getAction(PauseAction.class);
return (isPendingInput(run) &&
pauseAction != null && pauseAction.getCause().equals("Input"))
? GenericStatus.PAUSED_PENDING_INPUT : GenericStatus.IN_PROGRESS;
if (isPendingInput(run) &&
pauseAction != null && pauseAction.getCause().equals("Input")) {
return GenericStatus.PAUSED_PENDING_INPUT;
} else {
return GenericStatus.IN_PROGRESS;
}
} else {
// Final chunk on completed build
Result r = run.getResult();

0 comments on commit 63fd837

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