how to cancel build queue jobs in jenkins by only using the build number, which are not started by jenkins and are in its build queue through REST API

2,720 views
Skip to first unread message

tushar singhal

unread,
Dec 15, 2015, 8:56:43 AM12/15/15
to Jenkins Users
how to cancel build queue jobs in jenkins by only using the "build number" 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

Baptiste Mathus

unread,
Dec 17, 2015, 6:44:11 AM12/17/15
to jenkins...@googlegroups.com

Beware that deleting is not the same as cancelling a build.
If I were you I'd have a look at system groovy script instead of rest api.

Cheers

Le 15 déc. 2015 2:56 PM, "tushar singhal" <tusharsin...@gmail.com> a écrit :
how to cancel build queue jobs in jenkins by only using the "build number" 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

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/442e4d38-c8a5-43fe-8c59-33e6c04bfbb2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Daniel Beck

unread,
Dec 18, 2015, 7:53:34 PM12/18/15
to jenkins...@googlegroups.com

On 15.12.2015, at 14:56, tushar singhal <tusharsin...@gmail.com> wrote:

> how to cancel build queue jobs in jenkins by only using the "build number" through REST API, which are not started by jenkins and are in its build queue.

Trigger the build programmatically using the documented API (at /job/JOBNAME/api), and you know the queue item ID. Alternatively, access /queue/api/xml to find out queue IDs of current queue items.

Then just POST to /queue/cancelItem?id=1234 with 1234 being the queue item ID you want to cancel.

Reply all
Reply to author
Forward
0 new messages