创建执行机(节点)

../jenkins/computer/doCreateItem?name=slaveName&type=hudson.slaves.DumbSlave$DescriptorImpl&json=
{“name”:”slaveName”,
“nodeDescription”:”description”,
“numExecutors”:3,
“remoteFS”:”/jenkins_slave/”,
“labelString”:”tag”,
“mode”:”NORMAL”,
“type”:”hudson.slaves.DumbSlave$DescriptorImpl”,
“retentionStrategy”:{“staplerclass”:”hudson.slaves.RetentionStrategy$Always”},
“nodeProperties”:{“stapler-class-bag”:true},
“launcher”:{“stapler-class”:”hudson.plugins.sshslaves.SSHLauncher”,
“host”:”10.10.10.10”,
“port”:22,
“username”:”“,
“privatekey”:”“,
“credentialsId”:”credentials_id”}}

更新执行机(节点)配置

../jenkins/computer/aaaaa/config.xml
在此api中携带更新的config.xml配置即可。

删除单个执行机(节点)

../jenkins/computer/slaveName/doDelete

获取某个执行机(节点)的详细信息

../jenkins/computer/slaveName/api/xml?depth=1

断开某个执行机(节点)

../jenkins/computer/slaveName/doDisconnect

连接某个执行机(节点)

../jenkins/computer/slaveName/log

添加账户(credentials)

../jenkins/credentials/store/system/domain/_/createCredentials?json=
{“credentials”:
{“description”:”123456”,
“id”:”“,
“password”:”123456”,
“username”:”user”,
“scope”:”GLOBAL”,
“$class”:”com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl”},
“”:”0”}

获取所有credentials

../jenkins/credentials/store/system/domain/_/api/xml?depth=1
获取所有credentials之后解析xml文本内容即可获取想要的信息。

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐