In this page

Overview

Bamboo is Atlassian's solution for continuous integration, testing, deployment and software delivery.

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

  1. Login to Jira as admin, go to AdministrationSystemAutomation rules.
  2. Click Create rule.
  3. Select the trigger Changeset accepted (from the DevOps category).
  4. Click Save.
  5. Click New action.
  6. Select the action Send web request.
    1. 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.
    2. 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:
      1. The full header value looks something like "Basic YWRtaW46YWRtaW4=".
      2. Don't forget to put "Basic" to the start!
      3. 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.)
    3. Add a header with the name "Content-Length" header and with value "0".
    4. Choose POST as HTTP method.
    5. 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.
  7. Click Save.
  8. Name your automation rule intuitively, and click Turn it on.

Usage

  1. Create a commit with this commit message:
    Fix the FOO-1 bug.
  2. The Bamboo build will be started.

Troubleshooting

If you don't get the expected results:

  1. 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.

Need help following the configuration guide? Watch this 5-minute hands-on tutorial video:

Configuration

  1. Login to Jira as admin, go to AdministrationSystemAutomation rules.
  2. Click Create rule.
  3. Select the trigger Genius Commit created (from the DevOps category).
  4. Choose the command Build, and click Save.
  5. Click New action.
  6. Select the action Send web request.
    1. 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.
    2. 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:
      1. The full header value looks something like "Basic YWRtaW46YWRtaW4=".
      2. Don't forget to put "Basic" to the start!
      3. 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.)
    3. Add a header with the name "Content-Length" header and with value "0".
    4. Choose POST as HTTP method.
    5. 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.
  7. Click Save.
  8. Name your automation rule intuitively, and click Turn it on.

Usage

  1. Create a commit with this commit message:
    Fix the FOO-1 bug. @build
  2. The Bamboo build will be started.

Troubleshooting

If you don't get the expected results:

  1. Check if the @build command is defined in the Genius Commands screen? (It's a default command.)
  2. Check if the @build command was included in the commit message?
  3. 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:

  1. Login to Jira as admin, go to CommitsGenius Commands.
  2. Edit the command named Build.
  3. Enter the following regular expression as a parameter pattern: (?<buildPlanKey>.*).
  4. Click Save.
  5. Navigate to AdministrationSystemAutomation rules.
  6. Select your rule and edit the Send web request action.
  7. 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.
  8. Click Save, then Publish changes.

Usage

  1. Create a commit with this commit message:
    Fix the FOO-1 bug. @build LRT
  2. The Bamboo build plan with the key "LRT" will be started.

Troubleshooting

If you don't get the expected results:

  1. Check if the @build command is defined in the Genius Commands screen? (It's a default command.)
  2. Check if the @build command followed by the parameter was included in the commit message?
  3. 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:

  1. Login to Bamboo as admin, go to your plan, click ActionsConfigure planPlan ConfigurationsVariables.
  2. Enter "profile" in the Variable name field and set a default value if need (e.g. "production") in the Value field.
  3. Click Save.
  4. Login to Jira as admin, go to CommitsGenius Commands.
  5. Edit the command named Build.
  6. Enter the following regular expression as a parameter pattern: (?<buildParameter>.*).
  7. Click Save.
  8. Navigate to AdministrationSystemAutomation rules.
  9. Select your rule and edit the Send web request action.
  10. 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.
  11. Click Save, then Publish changes.

Usage

  1. Create a commit with this commit message:
    Fix the FOO-1 bug. @build production
  2. The Bamboo build will be started with the "profile" parameter set to "production".

Troubleshooting

If you don't get the expected results:

  1. Check if the @build command is defined in the Genius Commands screen? (It's a default command.)
  2. Check if the @build command followed by the parameter was included in the commit message?
  3. See the general troubleshooting steps.

Questions?

Ask us any time.