Java Code Examples for org.jenkinsci.plugins.workflow.graph.FlowNode#getAction()
The following examples show how to use
org.jenkinsci.plugins.workflow.graph.FlowNode#getAction() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GithubBuildStatusGraphListener.java From github-autostatus-plugin with MIT License | 5 votes |
/** * Gets the execution time of a block defined by startNode and endNode. * * @param startNode startNode of a block * @param endNode endNode of a block * @return Execution time of the block */ static long getTime(FlowNode startNode, FlowNode endNode) { TimingAction startTime = startNode.getAction(TimingAction.class); TimingAction endTime = endNode.getAction(TimingAction.class); if (startTime != null && endTime != null) { return endTime.getStartTime() - startTime.getStartTime(); } return 0; }
Example 2
Source File: GithubBuildStatusGraphListener.java From github-autostatus-plugin with MIT License | 5 votes |
/** * Determines if a {@link FlowNode} describes a stage. * * Note: this check is copied from PipelineNodeUtil.java in blueocean-plugin * * @param node node of a workflow * @return true if it's a stage node; false otherwise */ private static boolean isStage(FlowNode node) { if (node instanceof StepAtomNode) { // This filters out labelled steps, such as `sh(script: "echo 'hello'", label: 'echo')` return false; } return node != null && ((node.getAction(StageAction.class) != null) || (node.getAction(LabelAction.class) != null && node.getAction(ThreadNameAction.class) == null)); }
Example 3
Source File: PipelineNodeUtil.java From blueocean-plugin with MIT License | 5 votes |
@Nonnull public static String getDisplayName(@Nonnull FlowNode node) { ThreadNameAction threadNameAction = node.getAction(ThreadNameAction.class); return threadNameAction != null ? threadNameAction.getThreadName() : node.getDisplayName(); }
Example 4
Source File: JUnitResultsStepExecution.java From junit-plugin with MIT License | 5 votes |
/** * Get the stage and parallel branch start node IDs (not the body nodes) for this node, innermost first. * @param node A flownode. * @return A nonnull, possibly empty list of stage/parallel branch start nodes, innermost first. */ @Nonnull public static List<FlowNode> getEnclosingStagesAndParallels(FlowNode node) { List<FlowNode> enclosingBlocks = new ArrayList<>(); for (FlowNode enclosing : node.getEnclosingBlocks()) { if (enclosing != null && enclosing.getAction(LabelAction.class) != null) { if (isStageNode(enclosing) || (enclosing.getAction(ThreadNameAction.class) != null)) { enclosingBlocks.add(enclosing); } } } return enclosingBlocks; }
Example 5
Source File: JUnitResultsStepTest.java From junit-plugin with MIT License | 5 votes |
private static Predicate<FlowNode> branchForName(final String name) { return new Predicate<FlowNode>() { @Override public boolean apply(@Nullable FlowNode input) { return input != null && input.getAction(LabelAction.class) != null && input.getAction(ThreadNameAction.class) != null && name.equals(input.getAction(ThreadNameAction.class).getThreadName()); } }; }
Example 6
Source File: PipelineNodeUtil.java From blueocean-plugin with MIT License | 4 votes |
public static boolean isStage(FlowNode node){ return node !=null && ((node.getAction(StageAction.class) != null && !isSyntheticStage(node)) || (node.getAction(LabelAction.class) != null && node.getAction(ThreadNameAction.class) == null)); }
Example 7
Source File: PipelineNodeUtil.java From blueocean-plugin with MIT License | 4 votes |
public static boolean isParallelBranch(@Nullable FlowNode node){ return node !=null && node.getAction(LabelAction.class) != null && node.getAction(ThreadNameAction.class) != null; }
Example 8
Source File: PipelineBaseTest.java From blueocean-plugin with MIT License | 4 votes |
protected String getNodeName(FlowNode n){ return n.getAction(ThreadNameAction.class) != null ? n.getAction(ThreadNameAction.class).getThreadName() : n.getDisplayName(); }