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-ActivationOn 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 SwitcherOn 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.
Eg:Assuming we have 3 tasks in our plan:
We can use the following groovy script that will return expressions to match the tasks based on which is the current branch.
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.
'scriptBody':'echo This task was added dynamic',
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 !