Search in sources :

Example 1 with EnvironmentSpecific

use of hudson.model.EnvironmentSpecific in project hudson-2.x by hudson.

the class InstallToolCommand method install.

/**
 * Performs an installation.
 */
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();
    if (t instanceof NodeSpecific) {
        NodeSpecific n = (NodeSpecific) t;
        t = (ToolInstallation) n.forNode(node, new StreamTaskListener(stderr));
    }
    if (t instanceof EnvironmentSpecific) {
        EnvironmentSpecific e = (EnvironmentSpecific) t;
        t = (ToolInstallation) e.forEnvironment(EnvVars.getRemote(channel));
    }
    stdout.println(t.getHome());
    return 0;
}
Also used : Executor(hudson.model.Executor) EnvironmentSpecific(hudson.model.EnvironmentSpecific) StreamTaskListener(hudson.util.StreamTaskListener) Node(hudson.model.Node) NodeSpecific(hudson.slaves.NodeSpecific) Run(hudson.model.Run) AbortException(hudson.AbortException)

Aggregations

AbortException (hudson.AbortException)1 EnvironmentSpecific (hudson.model.EnvironmentSpecific)1 Executor (hudson.model.Executor)1 Node (hudson.model.Node)1 Run (hudson.model.Run)1 NodeSpecific (hudson.slaves.NodeSpecific)1 StreamTaskListener (hudson.util.StreamTaskListener)1