public RunList(Job j) { base = j.getBuilds(); }
public RunList(Collection<? extends Job> jobs) { List<Iterable<R>> runLists = new ArrayList<Iterable<R>>(); for (Job j : jobs) runLists.add(j.getBuilds()); this.base = combine(runLists); }
/** * @see LazyBuildMixIn#createHistoryWidget */ protected HistoryWidget createHistoryWidget() { return new HistoryWidget<Job, RunT>(this, getBuilds(), HISTORY_ADAPTER); }
public void doRssAll(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { rss(req, rsp, " all builds", getBuilds()); }
public BuildTimelineWidget getTimeline() { return new BuildTimelineWidget(getBuilds()); }
public RunList(View view) {// this is a type unsafe operation Set<Job> jobs = new HashSet<Job>(); for (TopLevelItem item : view.getItems()) jobs.addAll(item.getAllJobs()); List<Iterable<R>> runLists = new ArrayList<Iterable<R>>(); for (Job job : jobs) { runLists.add(job.getBuilds()); } this.base = combine(runLists); }
/** * Obtains a list of builds, in the descending order, that are within the specified time range [start,end). * * @return can be empty but never null. * @deprecated * as of 1.372. Should just do {@code getBuilds().byTimestamp(s,e)} to avoid code bloat in {@link Job}. */ @WithBridgeMethods(List.class) @Deprecated public RunList<RunT> getBuildsByTimestamp(long start, long end) { return getBuilds().byTimestamp(start,end); }
/** * Creates a a {@link RunList} combining all the runs of the supplied jobs. * * @param jobs the supplied jobs. * @param <J> the base class of job. * @param <R> the base class of run. * @return the run list. * @since 2.37 */ public static <J extends Job<J,R>, R extends Run<J,R>> RunList<R> fromJobs(Iterable<? extends J> jobs) { List<Iterable<R>> runLists = new ArrayList<>(); for (Job j : jobs) runLists.add(j.getBuilds()); return new RunList<>(combine(runLists)); }
/** * Gets the read-only view of the recent builds. * * @since 1.485 */ @Exported(name="builds") public RunList<RunT> getNewBuilds() { return getBuilds().limit(100); }
protected int run() throws Exception { RangeSet rs = RangeSet.fromString(range,false); return act((List)job.getBuilds(rs)); }
public void doRssFailed(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { rss(req, rsp, " failed builds", getBuilds().failureOnly()); }
/** * @since 1.517 * @return Returns a list of builds, filtered based on the filter value. */ public RunList getBuilds() { // use getFilter() method so we dont have to worry about null filter value. switch (getFilter()) { case COMPLETED: return getProject().getBuilds().overThresholdOnly(Result.ABORTED).completedOnly(); case SUCCESSFUL: return getProject().getBuilds().overThresholdOnly(Result.UNSTABLE).completedOnly(); case STABLE : return getProject().getBuilds().overThresholdOnly(Result.SUCCESS).completedOnly(); default: return getProject().getBuilds(); } }
/** * @deprecated Potentially very expensive call; do not use from Jelly views. */ @Deprecated public static boolean isApplicable(Collection<? extends Item> items) { for (Item item : items) { for (Job job : item.getAllJobs()) { RunList<? extends Run<?, ?>> runs = job.getBuilds(); for (Run<?,?> r : runs) { if (r instanceof RunWithSCM) { RunWithSCM<?,?> runWithSCM = (RunWithSCM<?,?>) r; for (ChangeLogSet<? extends Entry> c : runWithSCM.getChangeSets()) { for (Entry entry : c) { User user = entry.getAuthor(); if (user != null) return true; } } } } } } return false; } }
private static void remove(Saveable obj, boolean isDelete) { Jenkins j = Jenkins.getInstance(); OldDataMonitor odm = get(j); SecurityContext oldContext = ACL.impersonate(ACL.SYSTEM); try { odm.data.remove(referTo(obj)); if (isDelete && obj instanceof Job<?, ?>) { for (Run r : ((Job<?, ?>) obj).getBuilds()) { odm.data.remove(referTo(r)); } } } finally { SecurityContextHolder.setContext(oldContext); } }
private void locationChanged(Item item, String oldName, String newName) { if (item instanceof Job) { Job p = Jenkins.getInstance().getItemByFullName(newName, Job.class); if (p != null) { RunList<? extends Run> builds = p.getBuilds(); for (Run build : builds) { Collection<Fingerprint> fingerprints = build.getBuildFingerprints(); for (Fingerprint f : fingerprints) { try { f.rename(oldName, newName); } catch (IOException e) { logger.log(Level.WARNING, "Failed to update fingerprint record " + f.getFileName() + " when " + oldName + " was renamed to " + newName, e); } } } } } } }
private Map<User,UserInfo> getUserInfo(Collection<? extends Item> items) { Map<User,UserInfo> users = new HashMap<User,UserInfo>(); for (Item item : items) { for (Job<?, ?> job : item.getAllJobs()) { RunList<? extends Run<?, ?>> runs = job.getBuilds(); for (Run<?, ?> r : runs) { if (r instanceof RunWithSCM) { RunWithSCM<?,?> runWithSCM = (RunWithSCM<?,?>) r; for (ChangeLogSet<? extends Entry> c : runWithSCM.getChangeSets()) { for (Entry entry : c) { User user = entry.getAuthor(); UserInfo info = users.get(user); if (info == null) users.put(user, new UserInfo(user, job, r.getTimestamp())); else if (info.getLastChange().before(r.getTimestamp())) { info.project = job; info.lastChange = r.getTimestamp(); } } } } } } } return users; }
List<? extends Run<?,?>> builds = job.getBuilds(); for (Run r : copy(builds.subList(Math.min(builds.size(), numToKeep), builds.size()))) { if (shouldKeepRun(r, lsb, lstb)) { List<? extends Run<?,?>> builds = job.getBuilds(); for (Run r : copy(builds.subList(Math.min(builds.size(), artifactNumToKeep), builds.size()))) { if (shouldKeepRun(r, lsb, lstb)) {
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; }
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; }
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; }