如何通过python jenkinsapi更改Jenkins Node详细信息

时间:2017-09-15 08:58:43

标签: python jenkins jenkins-pipeline jenkins-cli

我已经阅读了很多Jenkins API文档。但我没有采用任何方法使用Python API更改Jenkins节点的细节。 基本上,这些是我想要改变的领域:

1)执行人员数量 2)标签 3)主持人

enter image description here

1 个答案:

答案 0 :(得分:0)

import jenkins.model.*
import hudson.model.*
import hudson.slaves.*
import hudson.plugins.sshslaves.*
import java.util.ArrayList;
import hudson.slaves.EnvironmentVariablesNodeProperty.Entry;

  Slave slave = new DumbSlave(
                    "agent-node","Agent node description",
                    "/home/jenkins",
                    "1",
                    Node.Mode.NORMAL,
                    "agent-node-label",
                    new SSHLauncher("agenNode",22,"user","password","","","","",""),
                    new RetentionStrategy.Always(),
                    new LinkedList())
  Jenkins.instance.addNode(slave)
相关问题