Is there a way to clear the build queue?

Hi all,
For the plugin I am working on, occasionally I want to clear the state of the build queue. Is there a way to do this through the plugin API? I couldn't find anything that looked like what I needed.

Thanks much,


There is no single method to clear the queue (in fact it exist but is not a part of open API), but you can iterate over build queue items and call removeFromQueue for each item. You will need to provide comment for this operation because this is similar to removing a build from the queue through the UI - i.e. cancelled build will be created in the history of corresponding build configuration in this case, argument user can be set to null.

If you cast BuildQueue to BuildQueueEx you will be able to use removeAllFromQueue() method, this will work faster if there are many builds in queue. But this method is not a part of open API and can be removed later.


Thanks Pavel, I will give that a try. : )


Please sign in to leave a comment.