protected Object readResolve() throws IOException { // If there's already a set of parallel stages defined, add that to the parallel content instead. if (this.parallel != null) { if (this.parallelContent == null) { this.parallelContent = new ArrayList<>(); } this.parallelContent.addAll(this.parallel.getStages()); this.parallel = null; } return this; }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } if (!super.equals(o)) { return false; } ModelASTStages that = (ModelASTStages) o; return getStages() != null ? getStages().equals(that.getStages()) : that.getStages() == null; }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } if (!super.equals(o)) { return false; } ModelASTStages that = (ModelASTStages) o; return getStages() != null ? getStages().equals(that.getStages()) : that.getStages() == null; }
@Exported public List<String> getRestartableStages() { List<String> stages = new ArrayList<>(); FlowExecution execution = getExecution(); if (execution != null) { ExecutionModelAction execAction = run.getAction(ExecutionModelAction.class); if (execAction != null) { if (execAction.getStages() != null) { for (ModelASTStage s : execAction.getStages().getStages()) { if (!Utils.stageHasStatusOf(s.getName(), execution, StageStatus.getSkippedForFailure(), StageStatus.getSkippedForUnstable())) { stages.add(s.getName()); } } } } } return stages; }
for (ModelASTStage s : stages.getStages()) { if ("parent".equals(s.getName())) { parentStage = s;
@Issue("JENKINS-46547") @Test public void multiplePipelinesDefinedInLibrary() throws Exception { otherRepo.init(); otherRepo.write("vars/fromLib.groovy", pipelineSourceFromResources("libForMultiplePipelinesDefinedInLibrary")); otherRepo.git("add", "vars"); otherRepo.git("commit", "--message=init"); LibraryConfiguration firstLib = new LibraryConfiguration("from-lib", new SCMSourceRetriever(new GitSCMSource(null, otherRepo.toString(), "", "*", "", true))); GlobalLibraries.get().setLibraries(Arrays.asList(firstLib)); WorkflowRun firstRun = expect("multiplePipelinesDefinedInLibraryFirst") .runFromRepo(false) .logContains("[Pipeline] { (One)", "[Pipeline] { (Two)") .logNotContains("World") .go(); ExecutionModelAction firstAction = firstRun.getAction(ExecutionModelAction.class); assertNotNull(firstAction); ModelASTStages firstStages = firstAction.getStages(); assertNotNull(firstStages); assertEquals(2, firstStages.getStages().size()); WorkflowRun secondRun = expect("multiplePipelinesDefinedInLibrarySecond") .runFromRepo(false) .logContains("[Pipeline] { (Different)", "This is the alternative pipeline") .go(); ExecutionModelAction secondAction = secondRun.getAction(ExecutionModelAction.class); assertNotNull(secondAction); ModelASTStages secondStages = secondAction.getStages(); assertNotNull(secondStages); assertEquals(1, secondStages.getStages().size()); }