use of org.jenkinsci.plugins.workflow.pipelinegraphanalysis.StageChunkFinder in project blueocean-plugin by jenkinsci.
the class PipelineNodeGraphVisitor method getPipelineNodeSteps.
@Override
public List<BluePipelineStep> getPipelineNodeSteps(final String nodeId, Link parent) {
FlowExecution execution = run.getExecution();
if (execution == null) {
logger.debug(String.format("Pipeline %s, runid %s has null execution", run.getParent().getName(), run.getId()));
return Collections.emptyList();
}
DepthFirstScanner depthFirstScanner = new DepthFirstScanner();
// If blocked scope, get the end node
FlowNode n = depthFirstScanner.findFirstMatch(execution.getCurrentHeads(), input -> (input != null && input.getId().equals(nodeId) && (PipelineNodeUtil.isStage(input) || PipelineNodeUtil.isParallelBranch(input))));
if (n == null) {
// if no node found or the node is not stage or parallel we return empty steps
return Collections.emptyList();
}
PipelineStepVisitor visitor = new PipelineStepVisitor(run, n);
ForkScanner.visitSimpleChunks(execution.getCurrentHeads(), visitor, new StageChunkFinder());
return visitor.getSteps().stream().map(node -> new PipelineStepImpl(node, parent)).collect(Collectors.toList());
}
use of org.jenkinsci.plugins.workflow.pipelinegraphanalysis.StageChunkFinder in project blueocean-plugin by jenkinsci.
the class PipelineNodeGraphVisitor method getPipelineNodeStep.
@Override
public BluePipelineStep getPipelineNodeStep(String id, Link parent) {
FlowExecution execution = run.getExecution();
if (execution == null) {
return null;
}
PipelineStepVisitor visitor = new PipelineStepVisitor(run, null);
ForkScanner.visitSimpleChunks(execution.getCurrentHeads(), visitor, new StageChunkFinder());
FlowNodeWrapper node = visitor.getStep(id);
if (node == null) {
return null;
}
return new PipelineStepImpl(node, parent);
}
use of org.jenkinsci.plugins.workflow.pipelinegraphanalysis.StageChunkFinder in project blueocean-plugin by jenkinsci.
the class PipelineBaseTest method getAllSteps.
protected List<FlowNode> getAllSteps(WorkflowRun run) {
PipelineStepVisitor visitor = new PipelineStepVisitor(run, null);
ForkScanner.visitSimpleChunks(run.getExecution().getCurrentHeads(), visitor, new StageChunkFinder());
List<FlowNode> steps = new ArrayList<>();
for (FlowNodeWrapper node : visitor.getSteps()) {
steps.add(node.getNode());
}
return steps;
}
use of org.jenkinsci.plugins.workflow.pipelinegraphanalysis.StageChunkFinder in project blueocean-plugin by jenkinsci.
the class PipelineNodeGraphVisitor method getPipelineNodeSteps.
@Override
public List<BluePipelineStep> getPipelineNodeSteps(Link parent) {
FlowExecution execution = run.getExecution();
if (execution == null) {
return Collections.emptyList();
}
PipelineStepVisitor visitor = new PipelineStepVisitor(run, null);
ForkScanner.visitSimpleChunks(execution.getCurrentHeads(), visitor, new StageChunkFinder());
return visitor.getSteps().stream().map(node -> new PipelineStepImpl(node, parent)).collect(Collectors.toList());
}
Aggregations