@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; }
@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; }
/** * Build numbers are always synchronized with the parent. * * <p> * Computing this is bit tricky. Several considerations: * * <ol> * <li>A new configuration build #N is started while the parent build #N is building, * and when that happens we want to return N. * <li>But the configuration build #N is done before the parent build #N finishes, * and when that happens we want to return N+1 because that's going to be the next one. * <li>Configuration builds might skip some numbers if the parent build is aborted * before this configuration is built. * <li>If nothing is building right now and the last build of the parent is #N, * then we want to return N+1. * </ol> */ @Override public int getNextBuildNumber() { MatrixBuild lcb = getParent().getLastCompletedBuild(); if (lcb == null) { return 0; } int n = lcb.getNumber() + 1; MatrixRun lb = getLastBuild(); if (lb != null) { n = Math.max(n, lb.getNumber() + 1); } return n; }
/** * Build numbers are always synchronized with the parent. * * <p> Computing this is bit tricky. Several considerations: * * <ol> <li>A new configuration build #N is started while the parent build * #N is building, and when that happens we want to return N. <li>But the * configuration build #N is done before the parent build #N finishes, and * when that happens we want to return N+1 because that's going to be the * next one. <li>Configuration builds might skip some numbers if the parent * build is aborted before this configuration is built. <li>If nothing is * building right now and the last build of the parent is #N, then we want * to return N+1. </ol> */ @Override public int getNextBuildNumber() { AbstractBuild lb = getParent().getLastBuild(); if (lb == null) { return 0; } int n = lb.getNumber(); if (!lb.isBuilding()) { n++; } lb = getLastBuild(); if (lb != null) { n = Math.max(n, lb.getNumber() + 1); } return n; }
/** * Build numbers are always synchronized with the parent. * * <p> * Computing this is bit tricky. Several considerations: * * <ol> * <li>A new configuration build #N is started while the parent build #N is building, * and when that happens we want to return N. * <li>But the configuration build #N is done before the parent build #N finishes, * and when that happens we want to return N+1 because that's going to be the next one. * <li>Configuration builds might skip some numbers if the parent build is aborted * before this configuration is built. * <li>If nothing is building right now and the last build of the parent is #N, * then we want to return N+1. * </ol> */ @Override public int getNextBuildNumber() { AbstractBuild lb = getParent().getLastBuild(); if(lb==null) return 0; int n=lb.getNumber(); if(!lb.isBuilding()) n++; lb = getLastBuild(); if(lb!=null) n = Math.max(n,lb.getNumber()+1); return n; }
/** * Build numbers are always synchronized with the parent. * * <p> * Computing this is bit tricky. Several considerations: * * <ol> * <li>A new configuration build #N is started while the parent build #N is building, * and when that happens we want to return N. * <li>But the configuration build #N is done before the parent build #N finishes, * and when that happens we want to return N+1 because that's going to be the next one. * <li>Configuration builds might skip some numbers if the parent build is aborted * before this configuration is built. * <li>If nothing is building right now and the last build of the parent is #N, * then we want to return N+1. * </ol> */ @Override public int getNextBuildNumber() { AbstractBuild lb = getParent().getLastBuild(); if(lb==null) return 0; int n=lb.getNumber(); if(!lb.isBuilding()) n++; lb = getLastBuild(); if(lb!=null) n = Math.max(n,lb.getNumber()+1); return n; }
/** * Build numbers are always synchronized with the parent. * * <p> * Computing this is bit tricky. Several considerations: * * <ol> * <li>A new configuration build #N is started while the parent build #N is building, * and when that happens we want to return N. * <li>But the configuration build #N is done before the parent build #N finishes, * and when that happens we want to return N+1 because that's going to be the next one. * <li>Configuration builds might skip some numbers if the parent build is aborted * before this configuration is built. * <li>If nothing is building right now and the last build of the parent is #N, * then we want to return N+1. * </ol> */ @Override public int getNextBuildNumber() { AbstractBuild lb = getParent().getLastBuild(); if(lb==null) return 0; int n=lb.getNumber(); if(!lb.isBuilding()) n++; lb = getLastBuild(); if(lb!=null) n = Math.max(n,lb.getNumber()+1); return n; }
@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(); } } }