Search in sources :

Example 1 with StepStartNode

use of org.jenkinsci.plugins.workflow.cps.nodes.StepStartNode in project blueocean-plugin by jenkinsci.

the class PipelineNodeGraphVisitor method chunkEnd.

@Override
public void chunkEnd(@Nonnull FlowNode endNode, @CheckForNull FlowNode afterBlock, @Nonnull ForkScanner scanner) {
    super.chunkEnd(endNode, afterBlock, scanner);
    if (isNodeVisitorDumpEnabled)
        dump(String.format("chunkEnd=> id: %s, name: %s, function: %s, type:%s", endNode.getId(), endNode.getDisplayName(), endNode.getDisplayFunctionName(), endNode.getClass()));
    if (isNodeVisitorDumpEnabled && endNode instanceof StepEndNode) {
        dump("\tStartNode: " + ((StepEndNode) endNode).getStartNode());
    }
    if (endNode instanceof StepStartNode) {
        if (endNode.getDisplayFunctionName().equals("node")) {
            agentNode = (StepStartNode) endNode;
        }
    }
    // capture orphan branches
    captureOrphanParallelBranches();
    //if block stage node push it to stack as it may have nested stages
    if (parallelEnd == null && endNode instanceof StepEndNode && //skip synthetic stages
    !PipelineNodeUtil.isSyntheticStage(((StepEndNode) endNode).getStartNode()) && PipelineNodeUtil.isStage(((StepEndNode) endNode).getStartNode())) {
        //XXX: There seems to be bug in eventing, chunkEnd is sent twice for the same FlowNode
        //     Lets peek and if the last one is same as this endNode then skip adding it
        FlowNode node = null;
        if (!nestedStages.empty()) {
            node = nestedStages.peek();
        }
        if (node == null || !node.equals(endNode)) {
            nestedStages.push(endNode);
        }
    }
    firstExecuted = null;
    // if we're using marker-based (and not block-scoped) stages, add the last node as part of its contents
    if (!(endNode instanceof BlockEndNode)) {
        atomNode(null, endNode, afterBlock, scanner);
    }
}
Also used : StepStartNode(org.jenkinsci.plugins.workflow.cps.nodes.StepStartNode) StepEndNode(org.jenkinsci.plugins.workflow.cps.nodes.StepEndNode) BlockEndNode(org.jenkinsci.plugins.workflow.graph.BlockEndNode) FlowNode(org.jenkinsci.plugins.workflow.graph.FlowNode)

Aggregations

StepEndNode (org.jenkinsci.plugins.workflow.cps.nodes.StepEndNode)1 StepStartNode (org.jenkinsci.plugins.workflow.cps.nodes.StepStartNode)1 BlockEndNode (org.jenkinsci.plugins.workflow.graph.BlockEndNode)1 FlowNode (org.jenkinsci.plugins.workflow.graph.FlowNode)1