hudson.model.Hudson.addNode()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(8.4k)|赞(0)|评价(0)|浏览(111)

本文整理了Java中hudson.model.Hudson.addNode()方法的一些代码示例,展示了Hudson.addNode()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Hudson.addNode()方法的具体详情如下:
包路径:hudson.model.Hudson
类名称:Hudson
方法名:addNode

Hudson.addNode介绍

[英]Adds one more Node to Hudson.
[中]向Hudson再添加一个节点。

代码示例

代码示例来源:origin: openshift/jenkins-cloud-plugin

public Node call() throws Exception {
    Hudson.getInstance().addNode(newSlave);
    return newSlave;
  }
});

代码示例来源:origin: org.eclipse.hudson/hudson-test-framework

public DumbSlave createSlave(String nodeName, String labels, EnvVars env) throws Exception {
  synchronized (hudson) {
    DumbSlave slave = new DumbSlave(nodeName, "dummy",
        createTmpDir().getPath(), "1", Node.Mode.NORMAL, labels==null?"":labels, createComputerLauncher(env), RetentionStrategy.NOOP, Collections.EMPTY_LIST);
    hudson.addNode(slave);
    return slave;
  }
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-test-harness

public PretendSlave createPretendSlave(FakeLauncher faker) throws Exception {
  synchronized (hudson) {
    int sz = hudson.getNodes().size();
    PretendSlave slave = new PretendSlave("slave" + sz, createTmpDir().getPath(), "", createComputerLauncher(null), faker);
    hudson.addNode(slave);
    return slave;
  }
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-test-framework

public PretendSlave createPretendSlave(FakeLauncher faker) throws Exception {
  synchronized (hudson) {
    int sz = hudson.getNodes().size();
    PretendSlave slave = new PretendSlave("slave" + sz, createTmpDir().getPath(), "", createComputerLauncher(null), faker);
    hudson.addNode(slave);
    return slave;
  }
}

代码示例来源:origin: org.eclipse.hudson/hudson-test-framework

/**
 * Creates a slave with certain additional environment variables
 */
public DumbSlave createSlave(String labels, EnvVars env) throws Exception {
  synchronized (hudson) {
    // this synchronization block is so that we don't end up adding the same slave name more than once.
    int sz = hudson.getNodes().size();
    DumbSlave slave = new DumbSlave("slave" + sz, "dummy",
        createTmpDir().getPath(), "1", Mode.NORMAL, labels == null ? "" : labels, createComputerLauncher(env), RetentionStrategy.NOOP, Collections.EMPTY_LIST);
    hudson.addNode(slave);
    return slave;
  }
}

代码示例来源:origin: org.eclipse.hudson/hudson-test-framework

public PretendSlave createPretendSlave(FakeLauncher faker) throws Exception {
  synchronized (hudson) {
    int sz = hudson.getNodes().size();
    PretendSlave slave = new PretendSlave("slave" + sz, createTmpDir().getPath(), "", createComputerLauncher(null), faker);
    hudson.addNode(slave);
    return slave;
  }
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-test-harness

/**
 * Creates a slave with certain additional environment variables
 */
public DumbSlave createSlave(String labels, EnvVars env) throws Exception {
  synchronized (hudson) {
    // this synchronization block is so that we don't end up adding the same slave name more than once.
    int sz = hudson.getNodes().size();
    DumbSlave slave = new DumbSlave("slave" + sz, "dummy",
        createTmpDir().getPath(), "1", Mode.NORMAL, labels==null?"":labels, createComputerLauncher(env), RetentionStrategy.NOOP, Collections.EMPTY_LIST);
    hudson.addNode(slave);
    return slave;
  }
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-test-framework

/**
 * Creates a slave with certain additional environment variables
 */
public DumbSlave createSlave(String labels, EnvVars env) throws Exception {
  synchronized (hudson) {
    // this synchronization block is so that we don't end up adding the same slave name more than once.
    int sz = hudson.getNodes().size();
    DumbSlave slave = new DumbSlave("slave" + sz, "dummy",
        createTmpDir().getPath(), "1", Mode.NORMAL, labels==null?"":labels, createComputerLauncher(env), RetentionStrategy.NOOP, Collections.EMPTY_LIST);
    hudson.addNode(slave);
    return slave;
  }
}

代码示例来源:origin: org.jenkins-ci.plugins/ec2

/**
 * Debug command to attach to a running instance.
 */
public void doAttach(StaplerRequest req, StaplerResponse rsp, @QueryParameter String id) throws ServletException, IOException, AmazonClientException {
  checkPermission(PROVISION);
  SlaveTemplate t = getTemplates().get(0);
  StringWriter sw = new StringWriter();
  StreamTaskListener listener = new StreamTaskListener(sw);
  EC2AbstractSlave node = t.attach(id,listener);
  Hudson.getInstance().addNode(node);
  rsp.sendRedirect2(req.getContextPath()+"/computer/"+node.getNodeName());
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

/**
 * Really creates a new slave.
 */
public synchronized void doDoCreateItem( StaplerRequest req, StaplerResponse rsp,
                    @QueryParameter String name,
                    @QueryParameter String type ) throws IOException, ServletException, FormException {
  final Hudson app = Hudson.getInstance();
  app.checkPermission(Hudson.ADMINISTER);  // TODO: new permission?
  checkName(name);
  Node result = NodeDescriptor.all().find(type).newInstance(req, req.getSubmittedForm());
  app.addNode(result);
  // take the user back to the slave list top page
  rsp.sendRedirect2(".");
}

代码示例来源:origin: hudson/hudson-2.x

/**
 * Really creates a new slave.
 */
public synchronized void doDoCreateItem( StaplerRequest req, StaplerResponse rsp,
                    @QueryParameter String name,
                    @QueryParameter String type ) throws IOException, ServletException, FormException {
  final Hudson app = Hudson.getInstance();
  app.checkPermission(Hudson.ADMINISTER);  // TODO: new permission?
  checkName(name);
  Node result = NodeDescriptor.all().find(type).newInstance(req, req.getSubmittedForm());
  app.addNode(result);
  // take the user back to the slave list top page
  rsp.sendRedirect2(".");
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

/**
 * Really creates a new slave.
 */
public synchronized void doDoCreateItem( StaplerRequest req, StaplerResponse rsp,
                    @QueryParameter String name,
                    @QueryParameter String type ) throws IOException, ServletException, FormException {
  final Hudson app = Hudson.getInstance();
  app.checkPermission(Hudson.ADMINISTER);  // TODO: new permission?
  checkName(name);
  Node result = NodeDescriptor.all().find(type).newInstance(req, req.getSubmittedForm());
  app.addNode(result);
  // take the user back to the slave list top page
  rsp.sendRedirect2(".");
}

代码示例来源:origin: org.jenkins-ci.plugins/ec2

public Node call() throws Exception {
    // TODO: record the output somewhere
    try {
      EC2AbstractSlave s = t.provision(StreamTaskListener.fromStdout());
      Hudson.getInstance().addNode(s);
      // EC2 instances may have a long init script. If we declare
      // the provisioning complete by returning without the connect
      // operation, NodeProvisioner may decide that it still wants
      // one more instance, because it sees that (1) all the slaves
      // are offline (because it's still being launched) and
      // (2) there's no capacity provisioned yet.
      //
      // deferring the completion of provisioning until the launch
      // goes successful prevents this problem.
      s.toComputer().connect(false).get();
      return s;
    }
    finally {
      decrementAmiSlaveProvision(t.ami);
    }
  }
})

代码示例来源:origin: org.jenkins-ci.plugins/ec2

public HttpResponse doProvision(@QueryParameter String template) throws ServletException, IOException {
  checkPermission(PROVISION);
  if(template==null) {
    throw HttpResponses.error(SC_BAD_REQUEST,"The 'template' query parameter is missing");
  }
  SlaveTemplate t = getTemplate(template);
  if(t==null) {
    throw HttpResponses.error(SC_BAD_REQUEST,"No such template: "+template);
  }
  StringWriter sw = new StringWriter();
  StreamTaskListener listener = new StreamTaskListener(sw);
  try {
    EC2AbstractSlave node = t.provision(listener);
    Hudson.getInstance().addNode(node);
    return HttpResponses.redirectViaContextPath("/computer/"+node.getNodeName());
  } catch (AmazonClientException e) {
    throw HttpResponses.error(SC_INTERNAL_SERVER_ERROR,e);
  }
}

代码示例来源:origin: openshift/jenkins-cloud-plugin

List<OpenShiftSlave> slaves = getSlaves();
for (OpenShiftSlave slave : slaves) {
  Hudson.getInstance().addNode(slave);

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

result.holdOffLaunchUntilSave = true;
app.addNode(result);

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

result.holdOffLaunchUntilSave = true;
app.addNode(result);

代码示例来源:origin: hudson/hudson-2.x

result.holdOffLaunchUntilSave = true;
app.addNode(result);

代码示例来源:origin: org.eclipse.hudson/hudson-core

/**
 * Really creates a new slave.
 */
public synchronized void doDoCreateItem(StaplerRequest req, StaplerResponse rsp,
    @QueryParameter String name,
    @QueryParameter String type) throws IOException, ServletException, FormException {
  final Hudson app = Hudson.getInstance();
  if (app.getTeamManager().isTeamManagementEnabled()) {
    app.checkPermission(Computer.CREATE);
  } else {
    app.checkPermission(Hudson.ADMINISTER);  // TODO: new permission?
  }
  checkName(name);
  Node result = NodeDescriptor.all().find(type).newInstance(req, req.getSubmittedForm());
  app.addNode(result);
  addToTeam(result.getNodeName(), null);
  // take the user back to the slave list top page
  rsp.sendRedirect2(".");
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

result.holdOffLaunchUntilSave = true;
app.addNode(result);

相关文章

Hudson类方法