Conditional Tasks in Bamboo

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

You can use variables and regular expressions to create conditions that have to be met to run a task. This way you can skip build steps in plan branches, decide what tasks are mandatory and what could be skipped, etc. You can set conditions for tasks through Bamboo UI or by using Bamboo Specs. For more information, see Configuring Tasks.

(Auto-migrated image: description temporarily unavailable)

The variable name shouldn't begin with bamboo. E.g., the variable bamboo.planRepository.branchName should be added as planRepository.branchName.

There aren't any notifications as to if the conditional task was either run or not. However, it's possible to check that in the build logs, like the examples below.

Example 1: a script task was skipped because it was configured with a condition that was not met.

1 simple 05-Aug-2021 19:08:18 Skipping task 'test script' because of unfulfilled condition. Reason: Variable abc equals 1

Example 2: a script task was executed because the condition was met.

1 2 simple 05-Aug-2021 19:09:01 All conditions for task 'test script' were met. Conditions: Variable abc equals 1 simple 05-Aug-2021 19:09:01 Starting task 'test script' of type 'com.atlassian.bamboo.plugins.scripttask:task.builder.script'

Solution

Environment

Bamboo 7.1 and newer

This feature is bundled with Bamboo.

Bamboo 7.0 and older

This feature can be enabled through a plugin: Conditional Tasks for Bamboo - Marketplace.

Troubleshooting common problems

The "Add condition to task" box is not visible

Bamboo 7.1 or newer:

A common cause for the box not being visible is that the bundledplugin is installed, but not enabled. In order to fix that:

  1. Click the

    (Auto-migrated image: description temporarily unavailable)

    icon > Overview > Manage apps under the Manage apps section

  2. Switch the filter to "System"

  3. Search for the "Conditional Tasks" plugin

  4. Click on Enable

    (Auto-migrated image: description temporarily unavailable)

Bamboo 7.0 or older:

You'll need to install the plugin

  1. Click the

    (Auto-migrated image: description temporarily unavailable)

    icon > Overview > Find new apps under the Manage apps section

  2. Search for "Conditional Tasks"

  3. Click on Install

    (Auto-migrated image: description temporarily unavailable)

Updated on April 15, 2025

Still need help?

The Atlassian Community is here for you.