Build Trigger Condition module

Available:

Bamboo 3.0 and later

Description

The buildTriggerCondition module provides the ability to gate whether a build should be triggered or not. It uses a preference system so multiple trigger condition plugins can be used to determine the desired result. A build which fails the trigger condition will not be executed, there will be no trace of the existence of this build. The following ExecutionPreferences are available (in order of priority - highest first)

  • MUST_STOP
  • MUST_RUN
  • SHOULD_STOP
  • SHOULD_RUN
  • NONE

SHOULD_RUN is the default used by Bamboo. Please carefully consider which preference you use, to allow for better integration with future plugins. For example you could have

  • Plugin A: Only will build if another build is green, will return SHOULD_STOP as its preference (if the other build is red)
  • Plugin B: Ensures that there is always a build once a day so can over-ride Plugin A by return MUST_RUN
  • Plugin C: Checks for resource availability and therefore can return MUST_STOP when a resource is not available, and override any other plugins which might want the plan to run.

Interface

Build Trigger Condition modules must implement the com.atlassian.bamboo.build.BuildTriggerCondition interface.

Sample Module Descriptor Element

1
2
3
4
5
6
<buildTriggerCondition key="plansGreenCondition" name="Plans Green Condition"
                      class="com.atlassian.bamboo.buildtrigger.PlansGreenCondition">
   <description>Checks that a given list of plans is green before triggering a build.</description>
   <resource type="freemarker" name="edit" location="editPlansGreenCondition.ftl"/>
   <resource type="freemarker" name="view" location="viewPlansGreenCondition.ftl"/>
 </buildTriggerCondition>