Identical tasks in plans, just the variables different - how best to implement?

We're using Bamboo to build Jekyll web sites from content in git repositories.

We've got develop & master branches, and staging & production web sites.

The tasks to build the web sites are identical for both - it is just the variables that change, to specify whether this is a staging build or a production build.

At the moment, I've got two separate plans - each with an identical set of tasks and slightly differing variables.

Is there a better way to do this? My concern is that I've got to keep the task configuration in sync and I'd prefer to try to have a "master" plan and then somehow specify the different variable values in order to generate the appropriate output.

Is that possible with Bamboo? Or am I thinking about this the "wrong" way?



2 answers

1 accepted

As long as you are only using long lived branches as outlined, you should be able to just use a single plan, create a manual plan branch, and then override the variables in the plan branch details configuration:


This approach seems to be working well. At the moment, the main plan is referencing the develop branch and I've created a plan branch for the master branch.

I'm toying with the idea of removing the repository from the main plan, so that it never directly triggers, and then adding the develop branch as a second plan branch. That seems to be more consistent than the way I've got it configured at the moment.

Just as a follow-up note, it is perfectly possible to remove the *trigger* from the main plan and add the develop branch as a second plan branch. It works well and BitBucket still recognises that a pull request against that branch is building even though the main plan isn't the one building it.

Thanks for the follow-up @Philip Colmer, using plan branches without the main plan is a neat approach I never even considered!

0 votes

You can also use Bamboo Specs which was released in Bamboo 6.0 and 6.1 to create Specs plans definition to provide a common definition and then create couple of separate plans which have different variables.  In this way you'll still have couple of separate plans but you won't need to have to keep them in sync since the definition will be generated by Bamboo Specs. 


Let's say:

public Stage getCommonStage(){
return new Stage() // configure here common parts of your plan

Plan prod = new Plan(...).stages(getCommonStage())
.variables(/*put variables here which are different for each plan*/)

Plan stage = new Plan(...).stages(getCommonStage())
.variables(/*put variable here which are different for each plan*/)

new BambooServer(...).publish(stage)
new BambooServer(...).publish(prod)

You can read more about Bamboo Specs here and here

Thanks, Grzegorz, for the suggestion. I decided to go with plan branches in the end because it was easier to get that solution in place and we don't have any Java programmers here. The documentation seems to suggest other languages can be used but it isn't clear how to adapt and I had some tight deadlines to hit.

Suggest an answer

Log in or Join to answer
Community showcase
Renan Battaglin
Published May 18, 2017 in Bamboo

FAQ: How to Upgrade Bamboo Server

Bamboo 5.9 will no longer be supported after June 12, 2017. What does this mean? As part of our End of Life policy, Atlassian supports major versions for two years after the first major iteratio...

1,072 views 0 5
Read article

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot