jenkins常用API

来源:互联网 发布:广州广大淘宝培训 编辑:程序博客网 时间:2024/05/19 04:26

创建执行机(节点)

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

0 0
原创粉丝点击