In this page
Starting a Bamboo build after every changeset
Configuration
Usage
Troubleshooting
Starting a Bamboo build with a specific command
Configuration
Usage
Troubleshooting
Starting a Bamboo build with a specific command and plan key
Configuration
Usage
Troubleshooting
Starting a Bamboo build with a specific command and plan parameter
Configuration
Usage
Troubleshooting
Overview
Bamboo is Atlassian's solution for continuous integration, testing, deployment and software delivery.
Watch this short tutorial video about configuring Bamboo automations, then follow the step-by-step guides in the next sections:
Starting a Bamboo build after every changeset
This automation starts a Bamboo build when a new changeset is received.
It is the simplest way to integrate Bamboo to your DevOps pipeline. It starts the build once per changeset, after all the commits in the changeset are already in the repository.
Configuration
- Login to Jira as admin, go to Administration → System → Automation rules.
- Click Create rule.
- Select the trigger Changeset accepted (from the DevOps category).
- Click Save.
- Click New action.
- Select the action Send web request.
-
Enter the Webhook URL as:
<YOUR_BAMBOO_SERVER_BASE_URL>/rest/api/latest/queue/<YOUR_BAMBOO_PROJECT_KEY>-<BAMBOO_PLAN_KEY>
Replace the placeholders with your actual Bamboo base URL, the Bamboo project key, a hyphen character ("-") and the plan key. -
Add a header with the name "Authorization" and with the value of the Basic Access Authentication credentials.
The credentials are generated from your Bamboo username and password.
Notes:- The full header value looks something like "Basic YWRtaW46YWRtaW4=".
- Don't forget to put "Basic" to the start!
- If you don't know how to generate the second part, use this safe online form. Just enter the username and the password in the format "myusername:mypassword" (separated with ":"), click Base64 Encode, then copy the resulted string back to the action's configuration. (The form runs fully in your browser, it does not store or transmit anything, therefore it is safe to use.)
- Add a header with the name "Content-Length" header and with value "0".
- Choose POST as HTTP method.
-
Validate your settings in the Validate your webhook configuration section below.
It will start a build if the configuration is valid.
Tip: if the URL contains smart values (variables), replace those with actual values (constants) for the time of the validation, then revert to the smart values after the configuration was successfully validated.
-
Enter the Webhook URL as:
- Click Save.
- Name your automation rule intuitively, and click Turn it on.
Usage
-
Create a commit with this commit message:
Fix the FOO-1 bug.
- The Bamboo build will be started.
Troubleshooting
If you don't get the expected results:
- See the general troubleshooting steps.
Starting a Bamboo build with a specific command
This automation starts a Bamboo build when the changeset includes a commit with a commit message that contains a certain command.
It is a more flexible variant of the previous automation, because you can control whether to start the build or not.
Configuration
- Login to Jira as admin, go to Administration → System → Automation rules.
- Click Create rule.
- Select the trigger Genius Commit created (from the DevOps category).
- Choose the command Build, and click Save.
- Click New action.
- Select the action Send web request.
-
Enter the Webhook URL as:
<YOUR_BAMBOO_SERVER_BASE_URL>/rest/api/latest/queue/<YOUR_BAMBOO_PROJECT_KEY>-<BAMBOO_PLAN_KEY>
Replace the placeholders with your actual Bamboo base URL, the Bamboo project key, a hyphen character ("-") and the plan key. -
Add a header with the name "Authorization" and with the value of the Basic Access Authentication credentials.
The credentials are generated from your Bamboo username and password.
Notes:- The full header value looks something like "Basic YWRtaW46YWRtaW4=".
- Don't forget to put "Basic" to the start!
- If you don't know how to generate the second part, use this safe online form. Just enter the username and the password in the format "myusername:mypassword" (separated with ":"), click Base64 Encode, then copy the resulted string back to the action's configuration. (The form runs fully in your browser, it does not store or transmit anything, therefore it is safe to use.)
- Add a header with the name "Content-Length" header and with value "0".
- Choose POST as HTTP method.
-
Validate your settings in the Validate your webhook configuration section below.
It will start a build if the configuration is valid.
Tip: if the URL contains smart values (variables), replace those with actual values (constants) for the time of the validation, then revert to the smart values after the configuration was successfully validated.
-
Enter the Webhook URL as:
- Click Save.
- Name your automation rule intuitively, and click Turn it on.
Usage
-
Create a commit with this commit message:
Fix the FOO-1 bug. @build
- The Bamboo build will be started.
Troubleshooting
If you don't get the expected results:
- Check if the @build command is defined in the Genius Commands screen? (It's a default command.)
- Check if the @build command was included in the commit message?
- See the general troubleshooting steps.
Starting a Bamboo build with a specific command and plan key
This automation starts a Bamboo build plan by parsing the build plan key from the VCS commit message:
It is a more flexible variant of the previous automation that allows choosing the build plan.
Configuration
In this example, the parameter "buildPlanKey" will be parsed from the commit message and passed to the build.
For this, first implement the "parameterless" automation using the previous guide. Then, execute these additional steps for the parameter:
- Login to Jira as admin, go to Commits → Genius Commands.
- Edit the command named Build.
- Enter the following regular expression as a parameter pattern: (?<buildPlanKey>.*).
- Click Save.
- Navigate to Administration → System → Automation rules.
- Select your rule and edit the Send web request action.
-
Modify the Webhook URL as:
<YOUR_BAMBOO_SERVER_BASE_URL>/rest/api/latest/queue/<YOUR_BAMBOO_PROJECT_KEY>-{{devops.buildPlanKey.urlEncode}}
Note that the command parameters should be URL-encoded with .urlEncode. Learn more about customizing the request in the Bamboo REST API documentation. - Click Save, then Publish changes.
Usage
-
Create a commit with this commit message:
Fix the FOO-1 bug. @build LRT
- The Bamboo build plan with the key "LRT" will be started.
Troubleshooting
If you don't get the expected results:
- Check if the @build command is defined in the Genius Commands screen? (It's a default command.)
- Check if the @build command followed by the parameter was included in the commit message?
- See the general troubleshooting steps.
Starting a Bamboo build with a specific command and plan parameter
This automation starts a Bamboo build by parsing a build plan parameter from the VCS commit message.
It is a more flexible variant of the previous automation that allows passing a build plan parameter.
Configuration
In this example, the parameter "buildParameter" will be parsed from the commit message and passed to the build.
For this, first implement the "parameterless" automation using the previous guide. Then, execute these additional steps for the parameter:
- Login to Bamboo as admin, go to your plan, click Actions → Configure plan → Plan Configurations → Variables.
- Enter "profile" in the Variable name field and set a default value if need (e.g. "production") in the Value field.
- Click Save.
- Login to Jira as admin, go to Commits → Genius Commands.
- Edit the command named Build.
- Enter the following regular expression as a parameter pattern: (?<buildParameter>.*).
- Click Save.
- Navigate to Administration → System → Automation rules.
- Select your rule and edit the Send web request action.
-
Modify the Webhook URL as:
<YOUR_BAMBOO_SERVER_BASE_URL>/rest/api/latest/queue/<BAMBOO_PROJECT_KEY>-<BAMBOO_PLAN_KEY>?bamboo.profile={{devops.buildParameter.urlEncode}}
Note that the command parameters shoud be URL-encoded with .urlEncode. Also don't forget to prefix the command parameter name with bamboo as in the example above. Learn more about customizing the request in the Bamboo REST API documentation. - Click Save, then Publish changes.
Usage
-
Create a commit with this commit message:
Fix the FOO-1 bug. @build production
- The Bamboo build will be started with the "profile" parameter set to "production".
Troubleshooting
If you don't get the expected results:
- Check if the @build command is defined in the Genius Commands screen? (It's a default command.)
- Check if the @build command followed by the parameter was included in the commit message?
- See the general troubleshooting steps.
Questions?
Ask us any time.