jenkins api

佐手、 提交于 2020-11-30 07:30:09

 

jenkins api

http://jen-server:8080/job/<view>/api/json

http://jenkins_site/computer/api/json?depth=1&pretty=true

1.LastBuild信息,这是一个build信息的字典:
可以获取值
"name":"GERRIT_CHANGE_NUMBER","value":"150410"
"name":"GERRIT_PATCHSET_NUMBER","value":"7"
"name":"GERRIT_REFSPEC","value":"refs/changes/10/150410/7"
"name":"GERRIT_CHANGE_URL","value":"https://git-1.devtools/gerrit/150410"}
"runs":[{"number":135,"url":"http://jen-server:8080/job/PRE_CI/label=master/135/"}
http://jen-server:8080/job/PRE_CI/lastBuild/api/json?prettye=true
2. 队列信息:
http://jen-server:8080/queue/api/json

items对应的是一个列表,不包含正在build的job
可以取到排队的task信息:
"name": "GERRIT_CHANGE_NUMBER",
"value": "150654"
"name": "GERRIT_PATCHSET_NUMBER",
"value": "7"
"id": 6414, #queueid
"url": "queue/item/6414/"

"name": "GERRIT_CHANGE_URL",
"value": "https://git-1.devtools:gerrit/150654"


3.取消任务队列

cancel 取消任务队列

POST http://127.0.0.1:8080/cancelItem?id={id}

4.停止构建,POST:
baseURL=<jenkins url>/view/<view name>/job/<job name>

          API: baseURL/<id>/stop

Reference:
https://blog.csdn.net/qq_34832393/article/details/88210942
https://blog.csdn.net/qq_34832393/article/details/88229804
https://www.jianshu.com/p/d77c6a7ec724

https://blog.csdn.net/xiaosongluo/article/details/52797156

no valid crumb: https://blog.51cto.com/13589448/2066437

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!