jenkins常用API

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/snow_114/article/details/70215530

创建执行机(节点)

../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文本内容即可获取想要的信息。

展开阅读全文

没有更多推荐了,返回首页