Dynamic Plans and DSL Plugin for Bamboo

Dynamic scripted variables:

- any variable containing the following pattern will be calculated script: if (repository_git_branch_0.equalsIgnoreCase("master")) return "true";

Conditioned scripted jobs

Dynamic Tasks De-Activation

On each job you can enter a groovy that will be evaluated.

If return is "true" some tasks having a description matching a configurable regular expression will be disabled.

Dynamic Tasks Switcher

On each job you can enter a groovy that will be evaluated and should return a regular expression

Any task having a description matching this regular expression will be set accordingly to your request.


Assuming we have 3 tasks in our plan:
  • develop
  • master
  • feature

We can use the following groovy script that will return expressions to match the tasks based on which is the current branch.

if (repository_git_branch_0.equalsIgnoreCase("master")) 
     return "master"; 
if (repository_git_branch_0.equalsIgnoreCase("develop")) 
     return "develop"; return "feature"; 
if (repository_git_branch_0.equalsIgnoreCase("develop")) 
     return "develop"; 
return "feature";

If in the settings we have placed Desired state as Enabled the plugin will tend to enable each task when branch is switching.

DSL Tasks (from version 3.0.1)

The DSL tasks are using a groovy based language with few predefined "keywords":
  • define "myVar","develop" - will define a new variable to be used in the job
  • append <build job key> - will read all tasks from the job mentioned and append them to the current job
  • task <plugin key>,<configuration map> - will append a new task to the current job
  • finaltask <plugin key>,<configuration map> - will append a new final task to the current job
Processing is not actually performed by the task itself, a prebuild phase is responsible for parsing and executing the content in the task.

Sample task:



if (repository_svn_repositoryUrl_0.contains("trunk"))
     define "myVar","develop" 
     define "myVar","other"

task 'com.atlassian.bamboo.plugins.scripttask:task.builder.script',
'scriptBody':'echo This task was added dynamic',

finaltask 'org.jfrog.bamboo.bamboo-artifactory-plugin:artifactoryGenericTask',

DSL Code Generator

In the administration page under the addons menu you will be able to locate the DSL Generator, is not perfect but it should get you started. The generator will allow you to pick a job and reverse engineer.

Running DSL without a task

While running some DSL in a task might be useful sometimes some other times it would be useful to store this configuration next to the source code. As of version 3.0.6 this is possible - create a file in your repository named bamboo.dsl.buildconfig and make sure it is being checked out at the root of working folder (this can be changed using Misc configuration tab of the job).

As part of the pre-build phase bamboo will load and execute the file !


  1. No examples for "Dynamic Tasks De-Activation" - just a screenshot of an empty form. Can you elaborate on how I use this plugin?

    1. Quite simple actually:

      Assume you have 2 tasks in your job: "Task 1" and "Task 2" and on master branch you dont want to run "Task 1"

      Fill under condition the following: if (repository_git_branch_0.equalsIgnoreCase("master")) return "true";
      Fill under task matcher: .*1.*

      Run and you get:

      26-Sep-2016 18:14:16 Groovy Shell starting
      26-Sep-2016 18:14:16 Groovy script if (repository_git_branch_0.equalsIgnoreCase("master")) return "true"; evaluated to [true]
      26-Sep-2016 18:14:16 Disabling task [task 1]
      26-Sep-2016 18:14:16 tasks list not set, skipping
      26-Sep-2016 18:14:16 Skipping execution of task 'task 1' as it is disabled
      26-Sep-2016 18:14:16 Starting task 'task 2' of type 'com.atlassian.bamboo.plugins.scripttask:task.builder.script'

      I use for example with deployments of artifacts to Nexus & Artifactory. I have a task deploying on a release repository and a secondary task deploying on a snapshot repository. On master I disable deploy to snapshot, on develop I disable deploy to release, on feature branches I disable all deployments.

    2. In case you wonder why I have similar functionalities in Dynamic Tasks Switcher, the task switcher is more flexible can enable/disable but I had already released the previous section of the plugin so I kept it for backwards compatibility last year.

  2. This comment has been removed by a blog administrator.