It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

Philip Colmer Aug 01, 2017

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?

Thanks.

 

2 answers

1 accepted

2 votes
Answer accepted
Steffen Opel [Utoolity] Community Leader Aug 01, 2017 • edited

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:

bamboo-plan-branch-variables-override.png

Philip Colmer Aug 02, 2017

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.

Philip Colmer Aug 03, 2017

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.

Steffen Opel [Utoolity] Community Leader Aug 03, 2017

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

0 votes
Grzegorz Lewandowski Atlassian Team Aug 02, 2017

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

Philip Colmer Aug 03, 2017

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 Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Opsgenie

Handling Opsgenie Alerts

Hi everyone, welcome to the kb articles for Opsgenie FAQs. I'm one of the Technical Support Engineers for Opsgenie who will be providing weekly posts on FAQs from customers.   All alerts are ...

66 views 0 3
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you