How to add a custom build to the head of the build queue?

Thanks to helpful people here I know how to javascript:;.

But now I need to figure out how to put it at the head of the build queue. Anyone know how?

What I'm doing is that I have a 'nightly' build that is quite important, so I want it to be able to jump to the front of the build queue.  I notice that this is possible to do when starting custom builds from the UI, so it's just a question of figuring out the API for it.

For some nightly builds I even want to stop another 'Rolling' build so that the nightly can start ASAP, so again I need to get my build to the head of the queue, otherwise I'll stop a build just to have another jump in front of me. (If that makes sense)


When a build is added to the queue via the addToQueue method, as a result you'll receive SQueuedBuild object. Each SQueuedBuild has unique itemId (getItemId() method). You can take BuildQueue service (available as usual Spring bean) and call method: moveTop(itemId) with itemId of the newly added queued build. This method will move the build to the top of the queue.


That's great, I will give that a try!


Yep, the method described worked perfectly - thanks!


Please sign in to leave a comment.