@Override public int assignBuildNumber() throws IOException { int nb = getNextBuildNumber(); MatrixRun r = getLastBuild(); if(r!=null && r.getNumber()>=nb) // make sure we don't schedule the same build twice throw new IllegalStateException("Build #"+nb+" is already completed"); return nb; }
@Override public int assignBuildNumber() throws IOException { int nb = getNextBuildNumber(); MatrixRun r = getLastBuild(); if(r!=null && r.getNumber()>=nb) // make sure we don't schedule the same build twice throw new IllegalStateException("Build #"+nb+" is already completed"); return nb; }
@Override public int assignBuildNumber() throws IOException { int nb = getNextBuildNumber(); MatrixRun r = getLastBuild(); if(r!=null && r.getNumber()>=nb) // make sure we don't schedule the same build twice throw new IllegalStateException("Build #"+nb+" is already completed"); return nb; }
/** * Gets the runs that has the same number as the build. * * @param matrixBuild the build. * @return the list of runs. */ public static List<MatrixRun> getRuns(MatrixBuild matrixBuild) { List<MatrixRun> runs = matrixBuild.getRuns(); List<MatrixRun> runsWithCorrectNumber = new LinkedList<MatrixRun>(); for (MatrixRun run : runs) { if (run.getNumber() == matrixBuild.getNumber()) { runsWithCorrectNumber.add(run); } } return runsWithCorrectNumber; } }
@Override public int assignBuildNumber() throws IOException { int nb = getNextBuildNumber(); MatrixRun r = getLastBuild(); if (r != null && r.getNumber() >= nb) // make sure we don't schedule the same build twice { throw new IllegalStateException("Build #" + nb + " is already completed"); } return nb; }
@Override public int assignBuildNumber() throws IOException { int nb = getNextBuildNumber(); MatrixRun r = getLastBuild(); if(r!=null && r.getNumber()>=nb) // make sure we don't schedule the same build twice throw new IllegalStateException("Build #"+nb+" is already completed"); return nb; }
/** * Gets the {@link MatrixBuild} that has the same build number. * * @return * null if no such build exists, which happens when the module build * is manually triggered. */ public MatrixBuild getParentBuild() { return getParent().getParent().getBuildByNumber(getNumber()); }
/** * Gets the {@link MatrixBuild} that has the same build number. * * @return * null if no such build exists, which happens when the module build * is manually triggered. */ public MatrixBuild getParentBuild() { return getParent().getParent().getBuildByNumber(getNumber()); }
/** * Gets the {@link MatrixBuild} that has the same build number. * * @return * null if no such build exists, which happens when the module build * is manually triggered. */ public MatrixBuild getParentBuild() { return getParent().getParent().getBuildByNumber(getNumber()); }
/** * Gets the {@link MatrixBuild} that has the same build number. * * @return null if no such build exists, which happens when the module build * is manually triggered. */ public MatrixBuild getParentBuild() { return getParent().getParent().getBuildByNumber(getNumber()); }
/** * Gets the {@link MatrixBuild} that has the same build number. * * @return * null if no such build exists, which happens when the module build * is manually triggered. */ public MatrixBuild getParentBuild() { return getParent().getParent().getBuildByNumber(getNumber()); }
/** * Method will add matrix sub job * failure causes to parent job. * @throws IOException IOException */ public void endMatrixBuildScan() throws IOException { List<MatrixRun> runs = ((MatrixBuild)build).getRuns(); List<MatrixRun> runsWithCorrectNumber = new LinkedList<MatrixRun>(); for (MatrixRun run : runs) { if (run.getNumber() == build.getNumber()) { runsWithCorrectNumber.add(run); } } build.addAction(new FailureCauseMatrixBuildAction((MatrixBuild)build, runsWithCorrectNumber)); build.save(); }
/** * 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; }
/** * @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; }
/** * 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 void perform(Job _job) throws IOException, InterruptedException { // Let superclass handle clearing artifacts, if configured: super.perform(_job); MatrixConfiguration job = (MatrixConfiguration) _job; // copy it to the array because we'll be deleting builds as we go. for( MatrixRun r : job.getBuilds().toArray(new MatrixRun[0]) ) { if(job.getParent().getBuildByNumber(r.getNumber())==null) r.delete(); } if(!job.isActiveConfiguration() && job.getLastBuild()==null) job.delete(); } }
@Override public void perform(Job _job) throws IOException, InterruptedException { // Let superclass handle clearing artifacts, if configured: super.perform(_job); MatrixConfiguration job = (MatrixConfiguration) _job; // copy it to the array because we'll be deleting builds as we go. for( MatrixRun r : job.getBuilds().toArray(new MatrixRun[0]) ) { if(job.getParent().getBuildByNumber(r.getNumber())==null) r.delete(); } if(!job.isActiveConfiguration() && job.getLastBuild()==null) job.delete(); } }
@Override public void perform(Job _job) throws IOException, InterruptedException { // Let superclass handle clearing artifacts, if configured: super.perform(_job); MatrixConfiguration job = (MatrixConfiguration) _job; // copy it to the array because we'll be deleting builds as we go. for( MatrixRun r : job.getBuilds().toArray(new MatrixRun[0]) ) { if(job.getParent().getBuildByNumber(r.getNumber())==null) r.delete(); } if(!job.isActiveConfiguration() && job.getLastBuild()==null) job.delete(); } }
@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); }
@Override public void perform(Job _job) throws IOException, InterruptedException { // Let superclass handle clearing artifacts, if configured: super.perform(_job); MatrixConfiguration job = (MatrixConfiguration) _job; // copy it to the array because we'll be deleting builds as we go. RunList<MatrixRun> builds = job.getBuilds(); for (MatrixRun r : builds.toArray(new MatrixRun[builds.size()])) { if (job.getParent().getBuildByNumber(r.getNumber()) == null) { r.delete(); } } if (!job.isActiveConfiguration() && job.getLastBuild() == null) { job.delete(); } } }