Task plugin module

Available:

Bamboo 3.1 and later

Purpose of this Module Type

A task plugin represents a unit of work during a Build. Each Job can now have multiple Tasks which run in order on a single Agent. If a Task fails the following tasks will not execute, with the exception of Final Tasks which will always execute. Tasks are designed to be easily extensible. To get a basic Task up and running, you simply need to implement a single Java interface. However, there are optional extension points that allow you to add a configuration screen and other powerful features to your Task. 

You can find in-depth details on creating a Task on the Tasks Overview page.

If you are looking to upgrade a Builder to a Task please see the LegacyBuilderToTaskConverter Plugin Module

Example

Minimal TaskType plugin

1
<taskType key="task.myExampleTask" name="Awesome Task"/>

Advanced TaskType plugin

1
2
3
4
5
6
7
8
9
10
<taskType key="task.builder.maven" name="Maven 1.x" class="com.atlassian.bamboo.plugins.maven.task.Maven1BuildTask">
        <description>Execute one or more Maven 1 goals as part of your build</description>
        <category name="builder"/>
        <category name="test"/>
        <executable key="maven" nameKey="builder.maven.executableName" pathHelpKey="builder.maven.helpPath"/>
        <capabilityDefaultsHelper class="com.atlassian.bamboo.plugins.maven.task.Maven1CapabilityDefaultsHelper"/>
        <configuration class="com.atlassian.bamboo.plugins.maven.task.configuration.Maven1BuildTaskConfigurator" />
        <resource type="freemarker" name="edit" location="com/atlassian/bamboo/plugins/maven/task/configuration/maven1BuildTaskEdit.ftl"/>
        <resource type="freemarker" name="view" location="com/atlassian/bamboo/plugins/maven/task/configuration/maven1BuildTaskView.ftl"/>
</taskType>

Interface

All TaskType modules must implement the TaskType interface.

Attributes

Name

Description

key

The unique identifier of the plugin module. You refer to this key to use the resource from other contexts in your plugin, such as from the plugin Java code or JavaScript resources.

1
2
3
<component-import 
  key="appProps" 
  interface="com.atlassian.sal.api.ApplicationProperties"/>

In the example, appProps is the key for this particular module declaration, for component-import, in this case.

Required: yes

More Information: -

name

The human-readable name of the plugin module. This name will be displayed when configuring Tasks

Required: yes

More Information: Selecting the TaskType

class

Your TaskType class. It must implement TaskType and provide the logic for executing a Task

 

Required: yes

 

More Information: Executing The Task

Elements

Name

Description

description

The description will be displayed to the user when selecting the TaskType to add to their Job.

Required: no

More Information: Selecting the TaskType

category

Determines which categories the TaskType will be displayed in, in the TaskType picker. You can have multiple category definitions. Available categories are "builder", "test", "deployment"

Required: no

More Information: Selecting the TaskType

executable

Allows you to define an Executable Type that users can add as Capabilities on their Agents.  In Bamboo 5.14+, you can have multiple executable definitions. You can then add Requirements on these Capabilities

Required: no

More Information: Tasks, Requirements And Capabilities

capabilityDefaultsHelper

Allows you to automatically detect Executables that the agent/server may have and add them as Capabilities

Required: no

More Information: Tasks, Requirements And Capabilities

configuration

Provide a way for users to configure your Task.

Required: no

More Information: Configuring The Task

view freemarker resource

The Freemarker template to be displayed when editing your task configuration (required if configuration element supplied)

Required: no

More Information: Configuring The Task

edit freemarker resource

The Freemarker template be displayed when viewing your task configuration (required if configuration element supplied)

Required: no

More Information: Configuring The Task

Tutorials

Get started writing your own Tasks with the following Tutorials: