use of hudson.model.Action in project blueocean-plugin by jenkinsci.
the class PipelineNodeGraphVisitor method parallelStart.
@Override
public void parallelStart(@Nonnull FlowNode parallelStartNode, @Nonnull FlowNode branchNode, @Nonnull ForkScanner scanner) {
if (isNodeVisitorDumpEnabled) {
dump(String.format("parallelStart=> id: %s, name: %s, function: %s", parallelStartNode.getId(), parallelStartNode.getDisplayName(), parallelStartNode.getDisplayFunctionName()));
dump(String.format("\tbranch=> id: %s, name: %s, function: %s", branchNode.getId(), branchNode.getDisplayName(), branchNode.getDisplayFunctionName()));
}
if (nestedbranches.size() != parallelBranchEndNodes.size()) {
logger.error(String.format("nestedBranches size: %s not equal to parallelBranchEndNodes: %s", nestedbranches.size(), parallelBranchEndNodes.size()));
return;
}
while (!nestedbranches.empty() && !parallelBranchEndNodes.empty()) {
FlowNode branchStartNode = nestedbranches.pop();
FlowNode endNode = parallelBranchEndNodes.pop();
TimingInfo times;
NodeRunStatus status;
if (endNode != null) {
// Branch has completed
times = StatusAndTiming.computeChunkTiming(run, chunk.getPauseTimeMillis(), branchStartNode, endNode, chunk.getNodeAfter());
if (endNode instanceof StepAtomNode) {
if (PipelineNodeUtil.isPausedForInputStep((StepAtomNode) endNode, inputAction)) {
status = new NodeRunStatus(BlueRun.BlueRunResult.UNKNOWN, BlueRun.BlueRunState.PAUSED);
} else {
status = new NodeRunStatus(endNode);
}
} else {
GenericStatus genericStatus = StatusAndTiming.computeChunkStatus2(run, parallelStartNode, branchStartNode, endNode, parallelEnd);
status = new NodeRunStatus(genericStatus);
}
} else {
// Branch still running / paused
long startTime = System.currentTimeMillis();
if (branchStartNode.getAction(TimingAction.class) != null) {
startTime = TimingAction.getStartTime(branchStartNode);
}
times = new TimingInfo(System.currentTimeMillis() - startTime, chunk.getPauseTimeMillis(), startTime);
status = new NodeRunStatus(BlueRun.BlueRunResult.UNKNOWN, BlueRun.BlueRunState.RUNNING);
}
// keep FB happy
assert times != null;
FlowNodeWrapper branch = new FlowNodeWrapper(branchStartNode, status, times, run);
// Collect any pending actions (required for most-recently-handled branch)
ArrayList<Action> branchActions = new ArrayList<>(drainPipelineActions());
// Add actions for this branch, which are collected when changing branches
if (pendingActionsForBranches.containsKey(branchStartNode)) {
branchActions.addAll(pendingActionsForBranches.get(branchStartNode));
pendingActionsForBranches.remove(branchStartNode);
}
branch.setPipelineActions(branchActions);
if (nextStage != null) {
branch.addEdge(nextStage);
}
parallelBranches.push(branch);
}
FlowNodeWrapper[] sortedBranches = parallelBranches.toArray(new FlowNodeWrapper[parallelBranches.size()]);
Arrays.sort(sortedBranches, new Comparator<FlowNodeWrapper>() {
@Override
public int compare(FlowNodeWrapper o1, FlowNodeWrapper o2) {
return o1.getDisplayName().compareTo(o2.getDisplayName());
}
});
parallelBranches.clear();
for (int i = 0; i < sortedBranches.length; i++) {
parallelBranches.push(sortedBranches[i]);
}
for (FlowNodeWrapper p : parallelBranches) {
nodes.push(p);
nodeMap.put(p.getId(), p);
}
// reset parallelEnd node for next parallel block
this.parallelEnd = null;
}
use of hudson.model.Action in project blueocean-plugin by jenkinsci.
the class PipelineNodeUtil method isSkippedStage.
public static boolean isSkippedStage(@Nullable FlowNode node) {
if (node == null) {
return false;
}
for (Action action : node.getActions()) {
if (action instanceof TagsAction && ((TagsAction) action).getTagValue(StageStatus.TAG_NAME) != null) {
TagsAction tagsAction = (TagsAction) action;
String value = tagsAction.getTagValue(StageStatus.TAG_NAME);
return value != null && value.equals(StageStatus.getSkippedForConditional());
}
}
return false;
}
use of hudson.model.Action in project blueocean-plugin by jenkinsci.
the class TryBlueOceanMenu method exists.
private boolean exists(Actionable actionable, BlueOceanUrlAction blueOceanUrlAction) {
for (Action a : actionable.getActions()) {
// JENKINS-44926 only call getURLName on these actions if action is BLueOceanUrlAction
if (a instanceof BlueOceanUrlAction) {
String blueUrl = blueOceanUrlAction.getUrlName();
String thisUrl = a.getUrlName();
if (thisUrl != null && thisUrl.equals(blueUrl)) {
return true;
}
}
}
return false;
}
use of hudson.model.Action in project gitlab-branch-source-plugin by Argelbargel.
the class SourceActions method retrieve.
@Nonnull
private List<Action> retrieve(@Nonnull SCMRevisionImpl revision, @CheckForNull SCMHeadEvent event, @Nonnull TaskListener listener) throws IOException, InterruptedException {
List<Action> actions = new ArrayList<>();
String hash = revision.getHash();
Action linkAction = GitLabLinkAction.toCommit(source.getProject(), hash);
actions.add(linkAction);
SCMHead head = revision.getHead();
if (head instanceof GitLabSCMMergeRequestHead) {
actions.add(createHeadMetadataAction(head.getName(), ((GitLabSCMMergeRequestHead) head).getSource(), hash, linkAction.getUrlName()));
} else if (head instanceof GitLabSCMHead) {
actions.add(createHeadMetadataAction(head.getName(), (GitLabSCMHead) head, hash, linkAction.getUrlName()));
}
if (event instanceof GitLabSCMEvent) {
actions.add(new GitLabSCMCauseAction(((GitLabSCMEvent) event).getCause()));
}
return actions;
}
Aggregations