how to cancel build queue jobs in jenkins through REST API, which are not started by jenkins and are in its build queue. I know how to cancel the in-progress job with below command
curl -X POST <jenkins-server>/job/<job-name>/<build-number>/doDelete
To cancel a job in the queue, you can POST:
http://jenkins/queue/cancelItem?id=x
To find x, you can parse the result of:
http://jenkins/queue/api/json?tree=items[id,task[name]]
To cancel a build that is in progress:
http://jenkins/job/<jobName>/y/stop
To find y, you can parse the result of:
http://jenkins/job/<jobName>/lastBuild/api/json?tree=building,number
无法通过其内部编号取消作业,只能通过作业ID:
curl -X POST 'http://jenkins/queue/cancelItem?id=85'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.