6

For example, by branch name you might want to execute different tasks (regress testing in release branches instead of massive integration tests for example).

Is there a mechanism to do that in Bamboo's UI?

Ta Mu
  • 6,772
  • 5
  • 39
  • 82
  • 3
    You could create separate build plans and have each of them trigger on a different set of branches (see the plan branches settings). – Byte Commander Jan 29 '18 at 09:29

2 Answers2

3

Atlassian Labs have now provided this functionality as an add-on: https://marketplace.atlassian.com/apps/1219706/conditional-tasks-for-bamboo?hosting=server&tab=overview

Only available for versions 6.7.1+

Update:

This add-on is only supported up to Bamboo 7.0.6 and conditional tasks are a standard feature in Bamboo 7.1+

https://confluence.atlassian.com/bamboo/bamboo-7-1-release-notes-1013854809.html

2

I don't know if there is some GUI way to do this

I am triggering the same plan in different ways from a REST request by using a variable

To do this

  1. define a variable in the plan configuration variables ie myvariable
  2. in the REST request set bamboo.variable.myvariable to the value required ie "1" or "2"
  3. in the plan stage add a task of script and use the variable as $bamboo_myvariable for instance

if [ "$bamboo_myvariable" == "1" ]; then # stuff to do variation 1 fi if [ "$bamboo_myvariable" == "2" ]; then # suff to do variation 2 fi

If you want to alter behaviour by branch there are variables such as "bamboo_planRepository_1_branch" which are available by default and could be used ina similar way

Vorsprung
  • 285
  • 3
  • 12