Hi,
I use the following code to walk through all stages of the pipeline for
a different reason but it could be an hint for you to achieve your goal:
WorkflowRun run = prevBuild.getRawBuild()
NodeGraphBuilder graphBuilder =
NodeGraphBuilder.NodeGraphBuilderFactory.getInstance(run);
def flowNodes = graphBuilder.getPipelineNodes()
for (Iterator iterator = flowNodes.iterator(); iterator.hasNext();) {
def node = iterator.next()
if (node.getDisplayName() == stageName) {
return node.getStatus().getResult() == BlueRunResult.SUCCESS
}
}
A stage is a pipeline node, but there are nodes that are not stages. So,
you probably need to dig into internal code to find out how to identify
only the stages.
Cheers,
Gianluca.