/** * Sets the base build from which this build is derived. * @since 1.416 */ public void setBaseBuild(MatrixBuild baseBuild) { this.baseBuild = (baseBuild==null || baseBuild==getPreviousBuild()) ? null : baseBuild.getNumber(); }
private MatrixRun getRunForConfiguration(MatrixConfiguration c) { for (MatrixBuild b=this; b!=null; b=b.getBaseBuild()) { MatrixRun r = c.getBuildByNumber(b.getNumber()); if (r!=null) return r; } return null; }
/** * True if this build didn't do a full build and it is depending on the result of the previous build. */ public boolean isPartial() { for(MatrixConfiguration c : getParent().getActiveConfigurations()) { MatrixRun b = c.getNearestOldBuild(getNumber()); if (b != null && b.getNumber()!=getNumber()) return true; } return false; }
/** * Returns all {@link MatrixRun}s for this {@link MatrixBuild}. */ public List<MatrixRun> getRuns() { List<MatrixRun> r = new ArrayList<MatrixRun>(); for (MatrixConfiguration c : getParent().getItems()) { MatrixRun b = c.getBuildByNumber(getNumber()); if (b != null) { r.add(b); } } return r; }
/** * Returns all {@link MatrixRun}s for this {@link MatrixBuild}. */ public List<MatrixRun> getRuns() { List<MatrixRun> r = new ArrayList<MatrixRun>(); for (MatrixConfiguration c : getParent().getItems()) { MatrixRun b = c.getBuildByNumber(getNumber()); if (b != null) { r.add(b); } } return r; }
/** * Returns all {@link MatrixRun}s for exactly this {@link MatrixBuild}. * <p> * Unlike {@link #getRuns()}, this method excludes those runs * that didn't run and got inherited. * @since 1.413 */ public List<MatrixRun> getExactRuns() { List<MatrixRun> r = new ArrayList<MatrixRun>(); for(MatrixConfiguration c : getParent().getItems()) { MatrixRun b = c.getBuildByNumber(getNumber()); if (b != null) r.add(b); } return r; }
/** * @return True if another {@link MatrixBuild} build (passed as a parameter) depends on this build. * @since 1.481 */ public boolean isLinkedBy(MatrixBuild b) { if(null == b) return false; for(MatrixConfiguration c : b.getParent().getActiveConfigurations()) { MatrixRun r = c.getNearestOldBuild(b.getNumber()); if (r != null && r.getNumber()==getNumber()) return true; } return false; }
/** * Returns all {@link MatrixRun}s for this {@link MatrixBuild}. */ public List<MatrixRun> getRuns() { List<MatrixRun> r = new ArrayList<MatrixRun>(); for (MatrixConfiguration c : getParent().getItems()) { MatrixRun b = c.getBuildByNumber(getNumber()); if (b != null) { r.add(b); } } return r; }
/** * Returns all {@link MatrixRun}s for this {@link MatrixBuild}. */ public List<MatrixRun> getRuns() { List<MatrixRun> r = new ArrayList<MatrixRun>(); for (MatrixConfiguration c : getParent().getItems()) { MatrixRun b = c.getBuildByNumber(getNumber()); if (b != null) { r.add(b); } } return r; }
/** * Gets the {@link MatrixRun} in this build that corresponds to the given * combination. */ public MatrixRun getRun(Combination c) { MatrixConfiguration config = getParent().getItem(c); if (config == null) { return null; } return config.getBuildByNumber(getNumber()); }
/** * Like {@link #getRun(Combination)}, but do not approximate the result by earlier execution * of the given combination (which is done for partial rebuild of the matrix.) */ public MatrixRun getExactRun(Combination c) { MatrixConfiguration config = getParent().getItem(c); if(config==null) return null; return config.getBuildByNumber(getNumber()); }
/** * Gets the {@link MatrixRun} in this build that corresponds * to the given combination. */ public MatrixRun getRun(Combination c) { MatrixConfiguration config = getParent().getItem(c); if (config == null) { return null; } return config.getBuildByNumber(getNumber()); }
/** * Gets the {@link MatrixRun} in this build that corresponds * to the given combination. */ public MatrixRun getRun(Combination c) { MatrixConfiguration config = getParent().getItem(c); if (config == null) { return null; } return config.getBuildByNumber(getNumber()); }
/** * Gets the {@link MatrixRun} in this build that corresponds * to the given combination. */ public MatrixRun getRun(Combination c) { MatrixConfiguration config = getParent().getItem(c); if (config == null) { return null; } return config.getBuildByNumber(getNumber()); }
@Override protected MatrixRun newBuild() throws IOException { // for every MatrixRun there should be a parent MatrixBuild MatrixBuild lb = getParent().getLastBuild(); MatrixRun lastBuild = new MatrixRun(this, lb.getTimestamp()); lastBuild.number = lb.getNumber(); builds.put(lastBuild); return lastBuild; }
@Override protected MatrixRun newBuild() throws IOException { // for every MatrixRun there should be a parent MatrixBuild MatrixBuild lb = getParent().getLastBuild(); MatrixRun lastBuild = new MatrixRun(this, lb.getTimestamp()); lastBuild.number = lb.getNumber(); builds.put(lastBuild); return lastBuild; }
@Override protected MatrixRun newBuild() throws IOException { // for every MatrixRun there should be a parent MatrixBuild MatrixBuild lb = getParent().getLastBuild(); MatrixRun lastBuild = new MatrixRun(this, lb.getTimestamp()); lastBuild.number = lb.getNumber(); builds.put(lastBuild); return lastBuild; }
@Override protected MatrixRun newBuild() throws IOException { // for every MatrixRun there should be a parent MatrixBuild MatrixBuild lb = getParent().getLastBuild(); MatrixRun lastBuild = new MatrixRun(this, lb.getTimestamp()); lastBuild.number = lb.getNumber(); builds.put(lastBuild); return lastBuild; }
/** * Return the URL to the run that this pointer references. * * In the typical case, this creates {@linkplain #getShortUrl() a very short relative url}. * If the referenced run is a nearest previous build, this method returns a longer URL to that exact build. * {@link MatrixRun} which belongs to a given build {@link MatrixBuild}. * If there is no run which belongs to the build, return url of run, which belongs to the nearest previous build. */ public String getNearestRunUrl() { MatrixRun r = getRun(); if (r==null) return null; if (getNumber()==r.getNumber()) return getShortUrl()+'/'; else return Stapler.getCurrentRequest().getContextPath()+'/'+r.getUrl(); }
@Override public Object getDynamic(String token, StaplerRequest req, StaplerResponse rsp) { try { MatrixRun item = getRun(Combination.fromString(token)); if(item!=null) { if (item.getNumber()==this.getNumber()) return item; else { // redirect the user to the correct URL String url = Functions.joinPath(item.getUrl(), req.getRestOfPath()); String qs = req.getQueryString(); if (qs!=null) url+='?'+qs; throw HttpResponses.redirectViaContextPath(url); } } } catch (IllegalArgumentException ignored) { // failed to parse the token as Combination. Must be something else } return super.getDynamic(token,req,rsp); }