如何取消 jenkins 中的构建队列作业,这些作业不是由 jenkins 启动的,而是通过 REST API 位于其构建队列中 [英] how to cancel build queue jobs in jenkins, which are not started by jenkins and are in its build queue through REST API

查看:95
本文介绍了如何取消 jenkins 中的构建队列作业,这些作业不是由 jenkins 启动的,而是通过 REST API 位于其构建队列中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何通过 REST API 取消 jenkins 中的构建队列作业,这些作业不是由 jenkins 启动的,而是在其构建队列中.我知道如何使用以下命令取消正在进行的作业

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                        

推荐答案

要取消队列中的作业,您可以 POST:

To cancel a job in the queue, you can POST:

http://jenkins/queue/cancelItem?id=x

要找到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

要找到y,可以解析以下结果:

To find y, you can parse the result of:

http://jenkins/job/<jobName>/lastBuild/api/json?tree=building,number

这篇关于如何取消 jenkins 中的构建队列作业,这些作业不是由 jenkins 启动的,而是通过 REST API 位于其构建队列中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆