Block build if child builds are queued or in progress

I know about the "Block build if parent builds are queued or in progress" dependency blocking strategies.

I would like a "Block build if child builds are queued or in progress" strategy. Is that possible to achieve?

We have a system that is made up of modules. Each module has a build plan. Every hour, a deployment plan takes all the latest modules, and deploys them on a server. That plan triggers a bunch of selenium system test child plans. These plans take some time to execute. Is it possible to somehow block the "deployment plan" from redeploying while there are triggered system test child plans that are still running?

1 answer

I don't think there is a built in way of doing this... but nothing says you can't get really creative with some odd-ball approach to achieve this :)

A possible solution would be to create a single agent that both parent and child plans rely on that gets tied up while the build is in progress, therefore not allowing one to start while the other is building.

Another solution would be to set up some script/program that queried Bamboo with the Atlassian Command Line Interface to see if that particular task was running.

bamboo --action getPlan --server http://localbambooserver:1234 --user bamboo_admin --password bamboo_admin_password --plan PROJECTKEY-PLANKEY

This will spit out something to the affect of

Key . . . . . . . . . . . . . : PROJECTKEY-PLANKEY
Name . . . . . . . . . . . . : Project Key - Plan Name
Description . . . . . . . . . : Plan Description
Short key . . . . . . . . . . : PLANKEY
Short name . . . . . . . . . : Plan Name
Enabled . . . . . . . . . . . : true
Is active . . . . . . . . . . : true
Is building . . . . . . . . . : true
Is favourite . . . . . . . . : false
Average build time (seconds) : 265.0
Link . . . . . . . . . . . . : http://localbambooserver:1234/rest/api/latest/plan/PROJECTKEY-PLANKEY

Then you can parse out the "Is Building" line to see if it's "true" or "false". Just test this every 10-15 seconds or so in a script until it's no longer building, then continue on with the rest of the build.

A little bit of a messy approach, but it'll work :)

Suggest an answer

Log in or Sign up to answer
Community showcase
Asked Dec 06, 2018 in Jira Ops

I'm John Allspaw, Ask Me Anything about incident analysis and postmortems

I'm John Allspaw, co-founder of   Adaptive Capacity Labs, where we help teams use their incidents to learn and improve. We bring research-driven methods and approaches to drive effective inciden...

5,619 views 22 17
View question

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you