Event for when a Deployment is Queued?

I’m writing a custom plugin to prioritise the build queue according to our requirements. It’s loosely based on the the Bamboo Queue Priority plugin by AtlassianLab (many thanks to them for publishing the source code!).

Everything is running fine when it comes to reordering build plans through an event listener for the BuildQueuedEvent. However, I’ve found that the DeploymentTriggeredEvent is given before the deployment is actually added to the build queue (and starting a deployment does not trigger a BuildQueuedEvent). Naturally, reordering the queue for an item that is not in it fails. I’ve implemented a workaround where I add triggered deployments to a delayed order change queue and have a background thread periodically checking if these deployments are now in the build queue. However, I’d like to just have an event I could listen to and execute the reorder code immediately.

Is there some sort of “DeploymentQueuedEvent” that I’m overlooking or does such a thing not exist?

Reposting this here since that was recommended on the Community Board

2 Likes