@Override public List<TopLevelItem> filter(List<TopLevelItem> added, List<TopLevelItem> all, View filteringView) { for (TopLevelItem item : all) { if (added.contains(item)) { continue; } if (SCMHead.HeadByItem.findHead(item) instanceof GitLabSCMTagHead) { added.add(item); } } return added; }
/** * {@inheritDoc} */ @Override public List<TopLevelItem> filter(List<TopLevelItem> added, List<TopLevelItem> all, View filteringView) { for (TopLevelItem item:all) { if (added.contains(item)) { continue; } if (SCMHead.HeadByItem.findHead(item) instanceof PullRequestSCMHead) { added.add(item); } } return added; }
/** * {@inheritDoc} */ @Override public List<TopLevelItem> filter(List<TopLevelItem> added, List<TopLevelItem> all, View filteringView) { for (TopLevelItem item:all) { if (added.contains(item)) { continue; } if (SCMHead.HeadByItem.findHead(item) instanceof BranchSCMHead) { added.add(item); } } return added; }
return; final SCMHead head = SCMHead.HeadByItem.findHead(job); if (head == null) { return;
return; final SCMHead head = SCMHead.HeadByItem.findHead(job); if (!(head instanceof PullRequestSCMHead)) { return;
assertEquals(new GitBranchSCMHead("master"), SCMHead.HeadByItem.findHead(p)); assertEquals(1, mp.getItems().size()); r.waitUntilNoActivity();
@Issue("JENKINS-37005") @Test public void noPropertiesWarnings() throws Exception { sampleRepo.init(); sampleRepo.write("Jenkinsfile", "echo \"branch=${env.BRANCH_NAME}\"\n" + "properties([disableConcurrentBuilds()])"); sampleRepo.write("file", "initial content"); sampleRepo.git("add", "Jenkinsfile"); sampleRepo.git("commit", "--all", "--message=flow"); WorkflowMultiBranchProject mp = r.jenkins.createProject(WorkflowMultiBranchProject.class, "p"); mp.getSourcesList().add(new BranchSource(new GitSCMSource(null, sampleRepo.toString(), "", "*", "", false), new DefaultBranchPropertyStrategy(new BranchProperty[0]))); for (SCMSource source : mp.getSCMSources()) { assertEquals(mp, source.getOwner()); } WorkflowJob p = scheduleAndFindBranchProject(mp, "master"); assertEquals(new GitBranchSCMHead("master"), SCMHead.HeadByItem.findHead(p)); assertEquals(1, mp.getItems().size()); r.waitUntilNoActivity(); WorkflowRun b1 = p.getLastBuild(); assertEquals(1, b1.getNumber()); // Now verify that we don't get any messages about removing properties when a property actually gets removed as // we add a new one. sampleRepo.write("Jenkinsfile", "echo \"branch=${env.BRANCH_NAME}\"\n" + "properties([buildDiscarder(logRotator(numToKeepStr: '1'))])"); sampleRepo.git("add", "Jenkinsfile"); sampleRepo.git("commit", "--all", "--message=flow"); r.assertBuildStatusSuccess(p.scheduleBuild2(0)); }
@Override public List<TopLevelItem> filter(List<TopLevelItem> added, List<TopLevelItem> all, View filteringView) { for (TopLevelItem item : all) { if (added.contains(item)) { continue; } SCMHead head = SCMHead.HeadByItem.findHead(item); if (head instanceof GitLabSCMMergeRequestHead && (!originOnly || ((GitLabSCMMergeRequestHead) head).fromOrigin())) { added.add(item); } } return added; }
@Override public List<TopLevelItem> filter(List<TopLevelItem> added, List<TopLevelItem> all, View filteringView) { for (TopLevelItem item : all) { if (added.contains(item)) { continue; } SCMHead head = SCMHead.HeadByItem.findHead(item); if (head instanceof GitLabSCMBranchHead && filter(item) && filter((GitLabSCMBranchHead) head)) { added.add(item); } } return added; }