public Run<?,?> resolve(Job<?,?> job) { return job.getLastCompletedBuild(); } };
@Override public ParameterValue getDefaultParameterValue() { if (runId != null) { return createValue(runId); } Run<?,?> lastBuild = null; // use getFilter() so we dont have to worry about null filter value. switch (getFilter()) { case COMPLETED: lastBuild = getProject().getLastCompletedBuild(); break; case SUCCESSFUL: lastBuild = getProject().getLastSuccessfulBuild(); break; case STABLE : lastBuild = getProject().getLastStableBuild(); break; default: lastBuild = getProject().getLastBuild(); break; } if (lastBuild != null) { return createValue(lastBuild.getExternalizableId()); } else { return null; } }
public Run<?,?> resolve(Job<?,?> job) { return job.getLastCompletedBuild(); } };
public RunT superGetLastCompletedBuild() { return super.getLastCompletedBuild(); }
@Override public String getUrlName() { Run<?, ?> run = this.project.getLastCompletedBuild(); if (run != null) { return run.getNumber() + "/" + ReportBuilder.BASE_DIRECTORY + "/" + ReportBuilder.HOME_PAGE; } // none build was completed, report is yet not available return ""; } }
@Override public Collection<String> getDockerImagesUsedByJob(Job<?,?> job) { Run<?,?> build = job.getLastCompletedBuild(); if (build != null) { ImageAction action = build.getAction(ImageAction.class); if (action != null) { Set<String> bareNames = new TreeSet<String>(); for (String name : action.names) { bareNames.add(name./* strip any tag or hash */replaceFirst("[:@].+", "")); } return bareNames; } } return Collections.emptySet(); }
/** * @return Build action to report. */ public FailureCauseBuildAction getAction() { Run<?, ?> build = job.getLastCompletedBuild(); if (build == null) { return null; } FailureCauseBuildAction action = build.getAction(FailureCauseBuildAction.class); if (action == null) { return null; } return action; } }
/** * Given a list of all jobs, return just those that are unstable or worse. */ public Collection<Job> getUnstableJobs(Collection<Job> allJobs) { ArrayList<Job> unstableJobs = new ArrayList<Job>(); for (Job job : allJobs) { Run run = job.getLastCompletedBuild(); if (run != null && Result.UNSTABLE.isBetterOrEqualTo(run.getResult())) { unstableJobs.add(job); } } return unstableJobs; }
/** * {@inheritDoc} */ @Override public Build getLastCompletedBuild(String jobName) { hudson.model.Job<?, ?> job = getHudsonJob(jobName); if (job.getLastCompletedBuild() != null) { log.fine("Mapping the last completed build of job " + job.getFullName()); return DozerUtils.getMapper().map(job.getLastCompletedBuild(), Build.class); } throw new NoSuchBuildException(jobName, "Last Completed"); }
/** * Returns this action as a collection of all project actions. * * Default jenkins behavior is to get the action on the last successful build (Stable or Unstable) * while we want the last completed build (Stable, Unstable or Failure). * * @return the project actions */ @Override public Collection<? extends Action> getProjectActions() { if (mRun != null) { return mRun.getParent().getLastCompletedBuild().getActions(RoundhouseAction.class); } else { return Collections.singletonList(this); } }
@Override public String getUrlName() { Job project = getProject(); if (project == null) { return null; } boolean isBuildable = project.isBuildable(); boolean hasCompletedBuild = project.getLastCompletedBuild() != null; if (isBuildable) { if (hasCompletedBuild) { return "lastCompletedBuild/rebuild"; } else { return "build?delay=0sec"; } } else { return null; } }
/** * Returns the last completed build, if any. Otherwise null. * * @return the build or null */ @SuppressWarnings(UNUSED) @CheckForNull @Exported public Run getLastCompletedBuild() { Run retVal = null; for (Job job : getAllJobs()) { retVal = takeLast(retVal, job.getLastCompletedBuild()); } return retVal; }
/** * If the last build is the same, * no need to regenerate the graph. Browser should reuse it's cached image * * @param req request * @param rsp response * @return true, if new image does NOT need to be generated, false otherwise */ private boolean newGraphNotNeeded(final StaplerRequest req, StaplerResponse rsp) { Calendar t = getProject().getLastCompletedBuild().getTimestamp(); return req.checkIfModified(t, rsp); }
public TestNGTestResultBuildAction getLastCompletedBuildAction() { for (Run<?, ?> build = getProject().getLastCompletedBuild(); build != null; build = build.getPreviousCompletedBuild()) { final TestNGTestResultBuildAction action = build.getAction(getBuildActionClass()); if (action != null) { return action; } } return null; }
protected void prepareWorkspace(Job job, ContainersContext context) { // TODO define a configurable volume strategy to retrieve a (maybe persistent) workspace Run lastBuild = job.getLastCompletedBuild(); if (lastBuild != null) { ContainersContext previousContext = lastBuild.getAction(ContainersContext.class); if (previousContext != null && previousContext.getWorkdirVolume() != null) { context.setWorkdirVolume(previousContext.getWorkdirVolume()); } } }
protected void prepareWorkspace(Job job, ContainersContext context) { // TODO define a configurable volume strategy to retrieve a (maybe persistent) workspace Run lastBuild = job.getLastCompletedBuild(); if (lastBuild != null) { ContainersContext previousContext = lastBuild.getAction(ContainersContext.class); if (previousContext != null && previousContext.getWorkdirVolume() != null) { context.setWorkdirVolume(previousContext.getWorkdirVolume()); } } }
public Collection<Run> getRecentReleases(int max) { LinkedList<Run> recentReleases = new LinkedList<Run>(); for (Job job : getDashboard().getJobs()) { for (Run run = job.getLastCompletedBuild(); run != null && (recentReleases.size() < max || run.getTimestamp().compareTo(recentReleases.getLast().getTimestamp()) > 0); run = run.getPreviousBuild()) { M2ReleaseBadgeAction mbb = run.getAction(M2ReleaseBadgeAction.class); if (mbb != null) { if (!insertRun(run, recentReleases, max)) { break; } } } } return recentReleases; }
@Override @Exported @QuickSilver public RunT getLastCompletedBuild() { initPython(); if (pexec.isImplemented(56)) { return (RunT) pexec.execPython("get_last_completed_build"); } else { return super.getLastCompletedBuild(); } }
private History createBuildHistory() { Run<?, ?> lastFinishedRun = owner.getLastCompletedBuild(); if (lastFinishedRun == null) { return new NullAnalysisHistory(); } else { return new AnalysisHistory(lastFinishedRun, new ByIdResultSelector(labelProvider.getId())); } }
protected DataSetBuilder<String, ChartLabel> createDataSet() { DataSetBuilder<String, ChartLabel> data = new DataSetBuilder<String, ChartLabel>(); Run<?, ?> build = project.getLastCompletedBuild(); while(build != null) { final List<CoverityBuildAction> actions = build.getActions(CoverityBuildAction.class); for(CoverityBuildAction action : actions) { if(action != null && action.getDefects() != null && action.getGraphDisplayName() != null) { data.add(action.getDefects().size(), action.getGraphDisplayName(), new ChartLabel(build)); } } build = build.getPreviousBuild(); } return data; }