Conditional Tasks in Bamboo

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

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

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.

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.

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.

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'

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 bundled plugin is installed, but not enabled. In order to fix that:

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

Bamboo 7.0 or older:

You'll need to install the plugin

  1. Click the  icon > OverviewFind new apps under the Manage apps section
  2. Search for "Conditional Tasks"
  3. Click on Install

Last modified on Aug 5, 2021

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.