/** * Returns the base {@link MatrixBuild} that this build originates from. * <p> * If this build is a partial build, unexecuted {@link MatrixRun}s are delegated to this build number. */ public MatrixBuild getBaseBuild() { return baseBuild==null ? getPreviousBuild() : getParent().getBuildByNumber(baseBuild); }
/** * 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()); }
/** * Helper method for {@link #readResolve()}, will try to find the upstream {@link MatrixBuild}. Since the run is * de-serialized badly (not referenced in the correct hierarchy) this could be a bit tricky. * * @param run the MatrixRun to search. * @return the correct instance if possible. */ private MatrixBuild findUpStream(MatrixRun run) { Cause.UpstreamCause cause = run.getCause(Cause.UpstreamCause.class); if (cause != null) { String project = cause.getUpstreamProject(); //Yes the folders plugin could cause problems here, // but stapler can't help me if I use the URL which would be preferred. //TODO what to do when the job is renamed? TopLevelItem item; item = Jenkins.getInstance().getItem(project); logger.log(Level.FINE, "Project item for {0} is {1}", new Object[]{project, item}); if (item != null && item instanceof MatrixProject) { logger.log(Level.FINEST, "It is a matrix project; searching for build {0}", cause.getUpstreamBuild()); //Find the build return ((MatrixProject)item).getBuildByNumber(cause.getUpstreamBuild()); } } return null; } }
@Override public void perform(Job _job) throws IOException, InterruptedException { // Let superclass handle clearing artifacts, if configured: super.perform(_job); if (!(_job instanceof MatrixConfiguration)) { LOGGER.log(Level.SEVERE, "Log rotator got a job with a wrong type. {0} of {1}", new Object[] {_job.getFullName(), _job.getClass()}); } MatrixConfiguration job = (MatrixConfiguration) _job; // copy it to the array because we'll be deleting builds as we go. for( MatrixRun r : job.getBuilds() ) { if(job.getParent().getBuildByNumber(r.getNumber())==null) { LOGGER.log(Level.FINE, "Deleting {0}", r.getFullDisplayName()); r.delete(); } } if(!job.isActiveConfiguration() && job.getLastBuild()==null) { LOGGER.log(Level.FINE, "Deleting {0} because the configuration is inactive and there''s no builds", job.getFullDisplayName()); 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 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. 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(); } } }