jenkins.branch.BranchProjectFactory Java Examples
The following examples show how to use
jenkins.branch.BranchProjectFactory.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MultiBranchPipelineImpl.java From blueocean-plugin with MIT License | 6 votes |
@Override public MultiBranchPipelineImpl getPipeline(Item item, Reachable parent, BlueOrganization organization) { if (item instanceof MultiBranchProject) { MultiBranchPipelineImpl mbpi = new MultiBranchPipelineImpl(organization, (MultiBranchProject) item); if (item instanceof WorkflowMultiBranchProject) { WorkflowMultiBranchProject wfmbp = (WorkflowMultiBranchProject)item; BranchProjectFactory<WorkflowJob, WorkflowRun> bpf = wfmbp.getProjectFactory(); if (bpf instanceof WorkflowBranchProjectFactory) { String sp = ((WorkflowBranchProjectFactory) bpf).getScriptPath(); mbpi.setScriptPath(sp); } } return mbpi; } return null; }
Example #2
Source File: GitHubSourceContext.java From github-integration-plugin with MIT License | 6 votes |
@SuppressWarnings({"rawtypes", "unchecked"}) private void forceScheduling(GitHubSCMRevision scmRevision) throws IOException { SCMSourceOwner owner = source.getOwner(); if (owner instanceof MultiBranchProject) { MultiBranchProject mb = (MultiBranchProject) owner; BranchProjectFactory pf = mb.getProjectFactory(); SCMHead scmHead = scmRevision.getHead(); Job j = mb.getItemByBranchName(scmHead.getName()); if (j != null) { SCMRevision rev = pf.getRevision(j); // set current rev to dummy to force scheduling if (rev != null && rev.equals(scmRevision)) { pf.setRevisionHash(j, new DummyRevision(scmHead)); } } } }
Example #3
Source File: Caches.java From blueocean-plugin with MIT License | 5 votes |
@Override public Optional<Branch> load(String key) throws Exception { Jenkins jenkins = Objects.firstNonNull(this.jenkins, Jenkins.getInstance()); Job job = jenkins.getItemByFullName(key, Job.class); if (job == null) { return Optional.absent(); } ObjectMetadataAction om = job.getAction(ObjectMetadataAction.class); PrimaryInstanceMetadataAction pima = job.getAction(PrimaryInstanceMetadataAction.class); String url = om != null && om.getObjectUrl() != null ? om.getObjectUrl() : null; if (StringUtils.isEmpty(url)) { /* * Borrowed from https://github.com/jenkinsci/branch-api-plugin/blob/c4d394415cf25b6890855a08360119313f1330d2/src/main/java/jenkins/branch/BranchNameContributor.java#L63 * for those that don't implement object metadata action */ ItemGroup parent = job.getParent(); if (parent instanceof MultiBranchProject) { BranchProjectFactory projectFactory = ((MultiBranchProject) parent).getProjectFactory(); if (projectFactory.isProject(job)) { SCMHead head = projectFactory.getBranch(job).getHead(); url = head.getName(); } } } if (StringUtils.isEmpty(url) && pima == null) { return Optional.absent(); } return Optional.of(new Branch(url, pima != null, BlueIssueFactory.resolve(job))); }
Example #4
Source File: BasicMultiBranchProject.java From basic-branch-build-strategies-plugin with MIT License | 4 votes |
@Override protected BranchProjectFactory<FreeStyleProject, FreeStyleBuild> newProjectFactory() { return new BasicBranchProjectFactory(); }
Example #5
Source File: PipelineMultiBranchDefaultsProject.java From pipeline-multibranch-defaults-plugin with MIT License | 4 votes |
@Nonnull protected BranchProjectFactory<WorkflowJob, WorkflowRun> newProjectFactory() { return new PipelineBranchDefaultsProjectFactory(); }
Example #6
Source File: MatrixMultiBranchProject.java From multi-branch-project-plugin with MIT License | 4 votes |
@Nonnull @Override protected BranchProjectFactory<MatrixProject, MatrixBuild> newProjectFactory() { return new MatrixBranchProjectFactory(); }
Example #7
Source File: IvyMultiBranchProject.java From multi-branch-project-plugin with MIT License | 4 votes |
@Nonnull @Override protected BranchProjectFactory<IvyModuleSet, IvyModuleSetBuild> newProjectFactory() { return new IvyBranchProjectFactory(); }
Example #8
Source File: FreeStyleMultiBranchProject.java From multi-branch-project-plugin with MIT License | 4 votes |
@Nonnull @Override protected BranchProjectFactory<FreeStyleProject, FreeStyleBuild> newProjectFactory() { return new FreeStyleBranchProjectFactory(); }
Example #9
Source File: MavenMultiBranchProject.java From multi-branch-project-plugin with MIT License | 4 votes |
@Nonnull @Override protected BranchProjectFactory<MavenModuleSet, MavenModuleSetBuild> newProjectFactory() { return new MavenBranchProjectFactory(); }