Java Code Examples for hudson.model.Job#getBuilds()
The following examples show how to use
hudson.model.Job#getBuilds() .
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: RunSearch.java From blueocean-plugin with MIT License | 6 votes |
public static Iterable<BlueRun> findRuns(Job job, final Link parent){ final List<BlueRun> runs = new ArrayList<>(); Iterable<Job> pipelines; if(job != null){ pipelines = ImmutableList.of(job); }else{ pipelines = Jenkins.getInstance().getItems(Job.class); } for (Job p : pipelines) { RunList<? extends Run> runList = p.getBuilds(); for (Run r : runList) { BlueRun run = BlueRunFactory.getRun(r, () -> parent); if (run != null) { runs.add(run); } } } return runs; }
Example 2
Source File: CukedoctorProjectAction.java From cucumber-living-documentation-plugin with MIT License | 6 votes |
@Override public Collection<? extends Action> createFor(Job<?, ?> j) { List<CukedoctorBuild> cukedoctorBuilds = new ArrayList<>(); //collects the list of builds that published living docs to show on the documentation history page if (j.getBuilds() != null && !j.getBuilds().isEmpty()) { for (Run<?, ?> build : j.getBuilds()) { CukedoctorBuildAction cukedoctorBuildAction = build.getAction(CukedoctorBuildAction.class); if (cukedoctorBuildAction != null) { cukedoctorBuilds.add(cukedoctorBuildAction.getCukedoctorBuild()); } } } if (cukedoctorBuilds.isEmpty()) { return Collections.emptyList(); } return Collections.singleton(new CukedoctorProjectAction(j, cukedoctorBuilds)); }
Example 3
Source File: BuildUtil.java From gitlab-plugin with GNU General Public License v2.0 | 5 votes |
public static Run<?, ?> getBuildByBranch(Job<?, ?> project, String branchName) { for (Run<?, ?> build : project.getBuilds()) { BuildData data = build.getAction(BuildData.class); MergeRecord merge = build.getAction(MergeRecord.class); if (hasLastBuild(data) && isNoMergeBuild(data, merge)) { for (Branch branch : data.lastBuild.getRevision().getBranches()) { if (branch.getName().endsWith("/" + branchName)) { return build; } } } } return null; }
Example 4
Source File: BuildUtil.java From gitlab-plugin with GNU General Public License v2.0 | 5 votes |
public static Run<?, ?> getBuildBySHA1WithoutMergeBuilds(Job<?, ?> project, String sha1) { for (Run<?, ?> build : project.getBuilds()) { MergeRecord merge = build.getAction(MergeRecord.class); for(BuildData data : build.getActions(BuildData.class)) { if (hasLastBuild(data) && isNoMergeBuild(data, merge) && data.lastBuild.isFor(sha1)) { return build; } } } return null; }
Example 5
Source File: BuildUtil.java From gitlab-plugin with GNU General Public License v2.0 | 5 votes |
public static Run<?, ?> getBuildBySHA1IncludingMergeBuilds(Job<?, ?> project, String sha1) { for (Run<?, ?> build : project.getBuilds()) { for(BuildData data : build.getActions(BuildData.class)) { if (data != null && data.lastBuild != null && data.lastBuild.getMarked() != null && data.lastBuild.getMarked().getSha1String().equals(sha1)) { return build; } } } return null; }