@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; }
ModelASTStages stages = action.getStages(); assertNull(stages.getSourceLocation()); assertNotNull(stages);
ExecutionModelAction action = b1.getAction(ExecutionModelAction.class); assertNotNull(action); ModelASTStages stages = action.getStages(); assertNotNull(stages);
@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()); }
ModelASTStages stages = action.getStages(); assertNull(stages.getSourceLocation()); assertNotNull(stages);
@Issue("JENKINS-42473") @Test public void folderLibraryParsing() throws Exception { otherRepo.init(); otherRepo.git("checkout", "-b", "test"); otherRepo.write("src/org/foo/Zot.groovy", "package org.foo;\n" + "\n" + "def echo(msg) {\n" + " echo \"-> ${msg}\"\n" + "}\n"); otherRepo.git("add", "src"); otherRepo.git("commit", "--message=init"); Folder folder = j.jenkins.createProject(Folder.class, "testFolder"); LibraryConfiguration echoLib = new LibraryConfiguration("zot-stuff", new SCMSourceRetriever(new GitSCMSource(null, otherRepo.toString(), "", "*", "", true))); folder.getProperties().add(new FolderLibraries(Collections.singletonList(echoLib))); WorkflowRun firstRun = expect("folderLibraryParsing") .inFolder(folder) .logContains("Hello world") .go(); WorkflowRun secondRun = j.buildAndAssertSuccess(firstRun.getParent()); ExecutionModelAction action = secondRun.getAction(ExecutionModelAction.class); assertNotNull(action); ModelASTStages stages = action.getStages(); assertNull(stages.getSourceLocation()); assertNotNull(stages); }