Package hudson.model

Examples of hudson.model.Node


        node = FilePathPickle.Listener.channelNames.get(workspace.getChannel());
        if (node == null) {
            throw new IllegalStateException("no known slave for " + workspace);
        }
        Jenkins j = Jenkins.getInstance();
        Node n = j == null ? null : node.isEmpty() ? j : j.getNode(node);
        labels = new TreeSet<LabelAtom>();
        if (n != null) {
            labels.addAll(n.getAssignedLabels());
            labels.remove(n.getSelfLabel());
        }
        path = workspace.getRemote();
        this.parent = parent;
    }
View Full Code Here


                    if (exec == null) {
                        throw new IllegalStateException("running task without associated executor thread");
                    }
                    Computer computer = exec.getOwner();
                    // Set up context for other steps inside this one.
                    Node node = computer.getNode();
                    if (node == null) {
                        throw new IllegalStateException("running computer lacks a node");
                    }
                    TaskListener listener = context.get(TaskListener.class);
                    Launcher launcher = node.createLauncher(listener);
                    Run<?,?> r = context.get(Run.class);
                    if (cookie == null) {
                        // First time around.
                        cookie = UUID.randomUUID().toString();
                        // Switches the label to a self-label, so if the executable is killed and restarted via ExecutorPickle, it will run on the same node:
                        label = computer.getName();
                        EnvVars env = computer.buildEnvironment(listener);
                        env.put(COOKIE_VAR, cookie);
                        synchronized (runningTasks) {
                            runningTasks.put(cookie, context);
                        }
                        // For convenience, automatically allocate a workspace, like WorkspaceStep would:
                        Job<?,?> j = r.getParent();
                        if (!(j instanceof TopLevelItem)) {
                            throw new Exception(j + " must be a top-level job");
                        }
                        FilePath p = node.getWorkspaceFor((TopLevelItem) j);
                        if (p == null) {
                            throw new IllegalStateException(node + " is offline");
                        }
                        WorkspaceList.Lease lease = computer.getWorkspaceList().allocate(p);
                        FilePath workspace = lease.path;
View Full Code Here

    public boolean start() throws Exception {
        Job<?,?> j = r.getParent();
        if (!(j instanceof TopLevelItem)) {
            throw new Exception(j + " must be a top-level job");
        }
        Node n = c.getNode();
        if (n == null) {
            throw new Exception("computer does not correspond to a live node");
        }
        FilePath p = n.getWorkspaceFor((TopLevelItem) j);
        if (p == null) {
            throw new IllegalStateException(n + " is offline");
        }
        WorkspaceList.Lease lease = c.getWorkspaceList().allocate(p);
        FilePath workspace = lease.path;
View Full Code Here

                listener = new StreamTaskListener(new FileOutputStream(la.getLogFile(), true));
            }
            return key.cast(listener);
        } else if (Node.class.isAssignableFrom(key)) {
            Computer c = get(Computer.class);
            Node n = null;
            if (c != null) {
                n = c.getNode();
            }
            /* contract is to quietly return null:
            if (n == null) {
                throw new IllegalStateException("There is no current node. Perhaps you forgot to call node?");
            }
            */
            return castOrNull(key, n);
        } else if (Run.class.isAssignableFrom(key)) {
            return castOrNull(key, getExecution().getOwner().getExecutable());
        } else if (Job.class.isAssignableFrom(key)) {
            return castOrNull(key, get(Run.class).getParent());
        } else if (key == Launcher.class) {
            Node n = get(Node.class);
            if (n == null) {
                return null;
            }
            return key.cast(n.createLauncher(get(TaskListener.class)));
        } else if (FlowExecution.class.isAssignableFrom(key)) {
            return castOrNull(key,getExecution());
        } else {
            // unrecognized key
            return null;
View Full Code Here

    }

    protected DockerCloud getCloud(AbstractBuild<?, ?> build) {
        DockerCloud cloud = null;

        Node node = build.getBuiltOn();
        if( node instanceof DockerSlave) {
            DockerSlave dockerSlave = (DockerSlave)node;
            cloud = dockerSlave.getCloud();
        }
View Full Code Here


    private DockerClient getDockerClient(AbstractBuild build) {


        Node node = build.getBuiltOn();
        if( node instanceof DockerSlave ) {
            DockerSlave slave = (DockerSlave)node;
            return slave.getCloud().connect();
        }
View Full Code Here

        return null;
    }

    private String getUrl(AbstractBuild build) {
        Node node = build.getBuiltOn();
        if( node instanceof DockerSlave ) {
            DockerSlave slave = (DockerSlave)node;
            return slave.getCloud().serverUrl;
        }
View Full Code Here

*/
@Extension(optional=true)
public class DockerHostTokenMacro extends DataBoundTokenMacro {
    @Override
    public String evaluate(AbstractBuild<?, ?> abstractBuild, TaskListener taskListener, String s) throws MacroEvaluationException, IOException, InterruptedException {
        Node node = abstractBuild.getBuiltOn();
        if( node instanceof DockerSlave) {
            DockerSlave dockerSlave = (DockerSlave)node;
            return dockerSlave.containerId;
        }

View Full Code Here

  public NodeParameters() {
  }

  @Override
  public Action getAction(AbstractBuild<?, ?> build, TaskListener listener) throws IOException, InterruptedException, DontTriggerException {
    Node node = build.getBuiltOn();
    Label nodeLabel;
    // master does not return a node name so add it explicitly.
    if(node == null) {
      nodeLabel = Jenkins.getInstance().getSelfLabel();
    } else {
      nodeLabel = node.getSelfLabel();
    }
    listener.getLogger().println("Returning node parameter for " + nodeLabel.getDisplayName());
    return new NodeAction(nodeLabel);
  }
View Full Code Here

    @Override
    public void onFinalized(Run r) {
        super.onFinalized(r);
        Computer computer = r.getExecutor().getOwner();
        Node node = computer.getNode();


        if (node instanceof VirtualMachineSlave) {
            VirtualMachineSlave slave = (VirtualMachineSlave)node;
View Full Code Here

TOP

Related Classes of hudson.model.Node

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.