use of org.jenkinsci.plugins.workflow.graph.AtomNode in project blueocean-plugin by jenkinsci.
the class PipelineStepVisitor method handleChunkDone.
@Override
protected void handleChunkDone(@Nonnull MemoryFlowChunk chunk) {
if (stageStepsCollectionCompleted) {
//if its completed no further action
return;
}
if (node != null && chunk.getFirstNode().equals(node)) {
stageStepsCollectionCompleted = true;
inStageScope = false;
try {
final String cause = PipelineNodeUtil.getCauseOfBlockage(chunk.getFirstNode(), agentNode, run);
if (cause != null) {
//Now add a step that indicates bloackage cause
FlowNode step = new AtomNode(chunk.getFirstNode().getExecution(), UUID.randomUUID().toString(), chunk.getFirstNode()) {
@Override
protected String getTypeDisplayName() {
return cause;
}
};
FlowNodeWrapper stepNode = new FlowNodeWrapper(step, new NodeRunStatus(BlueRun.BlueRunResult.UNKNOWN, BlueRun.BlueRunState.QUEUED), new TimingInfo(), run);
steps.push(stepNode);
stepMap.put(step.getId(), stepNode);
}
} catch (IOException | InterruptedException e) {
//log the error but don't fail. This is better as in worst case all we will lose is blockage cause of a node.
logger.error(String.format("Error trying to get blockage status of pipeline: %s, runId: %s node block: %s. %s", run.getParent().getFullName(), run.getId(), agentNode, e.getMessage()), e);
}
}
if (node != null && PipelineNodeUtil.isStage(node) && !inStageScope && !chunk.getFirstNode().equals(node)) {
resetSteps();
}
}
Aggregations