Package hudson

Examples of hudson.AbortException


        if(!parsed) {
            long localTime = System.currentTimeMillis();
            if(localTime < buildTime-1000) /*margin*/
                // build time is in the the future. clock on this slave must be running behind
                throw new AbortException(
                    "Clock on this slave is out of sync with the master, and therefore \n" +
                    "I can't figure out what test results are new and what are old.\n" +
                    "Please keep the slave clock in sync with the master.");

            File f = new File(baseDir,reportFiles[0]);
            throw new AbortException(
                String.format(
                "Test reports were found but none of them are new. Did tests run? %n"+
                "For example, %s is %s old%n", f,
                Util.getTimeSpanString(buildTime-f.lastModified())));
        }
View Full Code Here


        }
    }
   
    public Channel checkChannel() throws AbortException {
        if (channel==null)
            throw new AbortException("This command can only run with Jenkins CLI. See https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+CLI");
        return channel;
    }
View Full Code Here

        URL url;
        try {
            url = new URL(script);
        } catch (MalformedURLException e) {
            throw new AbortException("Unable to find a script "+script);
        }
        InputStream s = url.openStream();
        try {
            return IOUtils.toString(s);
        } finally {
View Full Code Here

                // files older than this timestamp is considered stale
                long localBuildTime = buildTime + (nowSlave - nowMaster);

                FilePath[] paths = new FilePath(dir).list(testResultLocations);
                if (paths.length==0)
                    throw new AbortException("No test reports that matches "+testResultLocations+" found. Configuration error?");

                // since dir is local, paths all point to the local files
                List<File> files = new ArrayList<File>(paths.length);
                for (FilePath path : paths) {
                    File report = new File(path.getRemote());
                    if (ignoreTimestampCheck || localBuildTime - 3000 /*error margin*/ < report.lastModified()) {
                        // this file is created during this build
                        files.add(report);
                    }
                }

                if (files.isEmpty()) {
                    // none of the files were new
                    throw new AbortException(
                        String.format(
                        "Test reports were found but none of them are new. Did tests run? %n"+
                        "For example, %s is %s old%n", paths[0].getRemote(),
                        Util.getTimeSpanString(localBuildTime-paths[0].lastModified())));
                }
View Full Code Here

        } finally {
            // remove myself from the parked list
            JobOffer offer = parked.remove(exec);
            if (offer != null && offer.workUnit != null) {
                // we are already assigned a project, but now we can't handle it.
                offer.workUnit.context.abort(new AbortException());
            }

            // since this executor might have been chosen for
            // maintenance, schedule another one. Worst case
            // we'll just run a pointless maintenance, and that's
View Full Code Here

        try {
            FileUtils.copyURLToFile(src,new File(dir, name));
        } catch (IOException e) {
            LOGGER.log(Level.SEVERE, "Failed to copy "+name,e);
            sendError("Failed to copy "+name+": "+e.getMessage(),req,rsp);
            throw new AbortException();
        }
    }
View Full Code Here

    private void notifyEndBuild(MatrixRun b, List<MatrixAggregator> aggregators) throws InterruptedException, IOException {
        if (b==null)    return; // can happen if the configuration run gets cancelled before it gets started.
        for (MatrixAggregator a : aggregators)
            if(!a.endRun(b))
                throw new AbortException();
    }
View Full Code Here

        // where is this build running?
        BuildIDs id = checkChannel().call(new BuildIDs());

        if (!id.isComplete())
            throw new AbortException("This command can be only invoked from a build executing inside Hudson");

        AbstractProject p = Jenkins.getInstance().getItemByFullName(id.job, AbstractProject.class);
        if (p==null)
            throw new AbortException("No such job found: "+id.job);
        p.checkPermission(Item.CONFIGURE);

        List<String> toolTypes = new ArrayList<String>();
        for (ToolDescriptor<?> d : ToolInstallation.all()) {
            toolTypes.add(d.getDisplayName());
View Full Code Here

        throw new AssertionError();
    }

    private int error(List<String> candidates, String given, String noun) throws AbortException {
        if (given ==null)
            throw new AbortException("No tool "+ noun +" was specified. Valid values are "+candidates.toString());
        else
            throw new AbortException("Unrecognized tool "+noun+". Perhaps you meant '"+ EditDistance.findNearest(given,candidates)+"'?");
    }
View Full Code Here

     */
    private int install(ToolInstallation t, BuildIDs id, AbstractProject p) throws IOException, InterruptedException {

        Run b = p.getBuildByNumber(Integer.parseInt(id.number));
        if (b==null)
            throw new AbortException("No such build: "+id.number);

        Executor exec = b.getExecutor();
        if (exec==null)
            throw new AbortException(b.getFullDisplayName()+" is not building");

        Node node = exec.getOwner().getNode();

        t = t.translate(node, EnvVars.getRemote(checkChannel()), new StreamTaskListener(stderr));
        stdout.println(t.getHome());
View Full Code Here

TOP

Related Classes of hudson.AbortException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.