Common Bamboo Classes

This page outlines some of the more commonly used classes in Bamboo plugins and what sort of information you can retrieve from them

The BuildContext

Every build task contains a BuildContext object. This class encapsulates how to build a particular plan and its state at a given time. You can make sure you have this available to your plugin by either extending the AbstractBuildTask or including the following code

private BuildContext buildContext;

public void init(@NotNull BuildContext buildContext)
    this.buildContext = buildContext;

The build context provide you with:


Interface that encapsulates the reason a build was triggered


All information required to execute a particular build plan


Encapsulates the repository changes for the particular build result


Subset of the full build result, defines the partial output of a plan being built


The BuildPlanDefinition interface encapsulates all information required to execute a particular build plan. The typical case is how to check out given a vcs revision key, then run the builder command and then collect all the various artifacts.


Used to perform source code related activities


The builder class knows how to execute your build and determine whether or not the build has passed

Custom Configuration

Any other configuration you want to add to the builds

Artifact Definitions

Which file patterns to copy as artifacts



The RespositoryV2 knows how to deal with your source code. Each type of repository stores its own configuration data required to checkout the source and check for code changes. Bamboo ships with an SvnRepository, CvsRepository and PerforceRepository.

This is where you find information such as

  • Source code directory - Where the source gets checked out to

  • Repository urls

    ((SvnRepository) buildContext.getBuildPlanDefinition().getRepository()).getRepositoryUrl()

Current Build Results

The CurrentBuildResults represents the state of the build results throughout the build process. There is variety of information stored in this class, however, different information becomes available at different times throughout the build.

Information you might find here:

  • Build state
  • Build return code
  • Test Results
  • Customer build data
  • Build Errors


The Build represents a Bamboo plan. It contains all the configuration information for the plan, as well as giving you the ability to navigate through the plan's build results. The easiest way to obtain a build is via the BuildManager which can be injected into your plugin.

Build build = buildManager.getBuildByKey(buildContext.getPlanKey());

Once you have the build you have access to such things as the

  • build definition - contains all the configuration specifics
  • build requirements - set of requirements associated for this build to run
  • parent and child builds
  • build logger

    BuildLogger buildLogger = build.getBuildLogger();

Build Result

A Build Result is a specific build of a plan e.g BAM-MAIN-567. Currently in Bamboo, build results information is split into two locations. The BuildResultSummary (or ExtendedBuildResultsSummary) is stored in the database and the BuildResult is what is stored as xml in bamboo-home/xml-data/builds/MYBUILDPLAN/results/.


  • Commit Information
  • Trigger Reason
  • Build State
  • Test Counts
  • The agent this build was built on
  • Vcs Revision Key
  • Related Jira Issues
  • Custom Build Data
  • Labels


  • Test results
  • Artifact information


The AdministrationConfiguration stores Bamboo's system wide properties such as the default url, instance name, global vairables (as defined in the admin section of Bamboo) and 'System Properties' - which is a map containing any other properties you may want to store for the instance.

You can obtain the administration configuration like so:

 public AdministrationConfiguration getAdministrationConfiguration()
     return (AdministrationConfiguration) ContainerManager.getComponent("administrationConfiguration");


The AdminErrorHandler error handler is responsible for dealing with errors that occur while building builds. Currently these errors are displayed on the dashboard of those who have admin privileges.

You can obtain the error handler like so:

 private AdminErrorHandler getAdminErrorHandler()
        if (adminErrorHandler == null)
            adminErrorHandler = (AdminErrorHandler) ContainerManager.getComponent("adminErrorHandler");
        return adminErrorHandler;
Was this page helpful?

Have a question about this article?

See questions about this article

Powered by Confluence and Scroll Viewport