public List<? extends ChangeLogSet<? extends ChangeLogSet.Entry>> getChangeSets() { if (build instanceof AbstractBuild) { return Collections.singletonList(((AbstractBuild<?, ?>) build).getChangeSet()); } else if (build instanceof WorkflowRun) { return ((WorkflowRun) build).getChangeSets(); } return null; }
private List<Change> getChangelog(WorkflowRun build) { return Change.getChanges(build.getChangeSets()); }
public boolean hasChangeSet() { if (build instanceof AbstractBuild) { return !((AbstractBuild<?, ?>) build).getChangeSet().isEmptySet(); } else if (build instanceof WorkflowRun) { return !((WorkflowRun) build).getChangeSets().isEmpty(); } return false; }
private void onCheckout(SCM scm, FilePath workspace, TaskListener listener, @CheckForNull File changelogFile, @CheckForNull SCMRevisionState pollingBaseline) throws Exception { if (changelogFile != null && changelogFile.isFile()) { ChangeLogSet<?> cls = scm.createChangeLogParser().parse(this, scm.getEffectiveBrowser(), changelogFile); if (!cls.isEmptySet()) { getChangeSets().add(cls); } for (SCMListener l : SCMListener.all()) { l.onChangeLogParsed(this, scm, listener, cls); } } checkouts(listener).add(new SCMCheckout(scm, FilePathUtils.getNodeName(workspace), workspace.getRemote(), changelogFile, pollingBaseline)); }
public static Pipeline resolve(WorkflowJob project, WorkflowRun build) throws PipelineException { String pipelineTimestamp = TimestampFormat.formatTimestamp(build.getTimeInMillis()); List<FlowNode> stageNodes = FlowNodeUtil.getStageNodes(build.getExecution()); return new Pipeline(project.getName(), build.getDisplayName(), Stage.extractStages(build, stageNodes), Change.getChanges(build.getChangeSets()), TriggerCause.getTriggeredBy(project, build), pipelineTimestamp); }
assertNotNull(failing.getChangeSets()); assertFalse(failing.getChangeSets().isEmpty()); assertEquals(1, failing.getChangeSets().size()); ChangeLogSet<? extends ChangeLogSet.Entry> failingChanges = failing.getChangeSets().get(0); assertEquals(1, failingChanges.getItems().length); ChangeLogSet.Entry failingEntry = failingChanges.iterator().next(); j.assertLogNotContains("This shouldn't show up on third run", b3); assertNotNull(b3.getChangeSets()); assertFalse(b3.getChangeSets().isEmpty()); assertEquals(1, b3.getChangeSets().size()); ChangeLogSet<? extends ChangeLogSet.Entry> b3Changes = failing.getChangeSets().get(0); assertEquals(1, b3Changes.getItems().length); ChangeLogSet.Entry b3Entry = b3Changes.iterator().next();
assertEquals(otherRepo.trunkUrl().replaceFirst("/$", ""), ((SubversionSCM) scms.next()).getLocations()[0].getURL()); assertFalse(scms.hasNext()); List<ChangeLogSet<? extends ChangeLogSet.Entry>> changeSets = b.getChangeSets(); assertEquals(2, changeSets.size()); ChangeLogSet<? extends ChangeLogSet.Entry> changeSet = changeSets.get(0);
r.assertLogContains("version two", b); r.assertLogNotContains("Retrying after 10 seconds", b); List<ChangeLogSet<? extends ChangeLogSet.Entry>> changeSets = b.getChangeSets(); assertEquals(1, changeSets.size()); ChangeLogSet<? extends ChangeLogSet.Entry> changeSet = changeSets.get(0);
assertEquals(otherRepo.toURI().toString(), ((MercurialSCM) scms.next()).getSource()); assertFalse(scms.hasNext()); List<ChangeLogSet<? extends ChangeLogSet.Entry>> changeSets = b.getChangeSets(); assertEquals(2, changeSets.size()); ChangeLogSet<? extends ChangeLogSet.Entry> changeSet = changeSets.get(0);
@Issue("JENKINS-29881") @Test public void emptyChangeLogEmptyChangeSets() throws Exception { sampleRepo.init(); sampleRepo.write("flow.groovy", "echo 'version one'"); sampleRepo.git("add", "flow.groovy"); sampleRepo.git("commit", "--message=init"); WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p"); CpsScmFlowDefinition def = new CpsScmFlowDefinition(new GitStep(sampleRepo.toString()).createSCM(), "flow.groovy"); def.setLightweight(false); p.setDefinition(def); WorkflowRun b = r.assertBuildStatusSuccess(p.scheduleBuild2(0)); r.assertLogContains("Cloning the remote Git repository", b); r.assertLogContains("version one", b); r.assertLogNotContains("Retrying after 10 seconds", b); b = r.assertBuildStatusSuccess(p.scheduleBuild2(0)); assertEquals(2, b.number); List<ChangeLogSet<? extends ChangeLogSet.Entry>> changeSets = b.getChangeSets(); assertEquals(Collections.emptyList(), changeSets); }
assertRevisionAction(b2); WorkflowMultiBranchProjectTest.showIndexing(mp); List<ChangeLogSet<? extends ChangeLogSet.Entry>> changeSets = b2.getChangeSets(); assertEquals(1, changeSets.size()); ChangeLogSet<? extends ChangeLogSet.Entry> changeSet = changeSets.get(0);
r.assertLogContains("initial content", r.waitForCompletion(b1)); r.assertLogContains("SUBSEQUENT CONTENT", b2); List<ChangeLogSet<? extends ChangeLogSet.Entry>> changeSets = b2.getChangeSets();
r.assertLogContains("initial content", r.assertBuildStatusSuccess(b1)); r.assertLogContains("SUBSEQUENT CONTENT", r.assertBuildStatusSuccess(b2)); List<ChangeLogSet<? extends ChangeLogSet.Entry>> changeSets = b2.getChangeSets();
r.assertLogContains("initial content", r.assertBuildStatusSuccess(b1)); r.assertLogContains("SUBSEQUENT CONTENT", r.assertBuildStatusSuccess(b2)); List<ChangeLogSet<? extends ChangeLogSet.Entry>> changeSets = b2.getChangeSets();