Last updated Dec 8, 2017

Bamboo API Changes for Bamboo 3.1

General Notes

In 3.1 we have introduced Tasks. 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 pluginable and have replaced Bamboo's Builders.  We have included a Compatability Task which will run old Builder configurations however, we encourage you to update Builders as soon as possible.

We've made writing new Task plugins incredibly easy. You can find all the information on creating Tasks on our Tasks Overview page. Also on that page you can find information regarding the new way we handle Requirements and Capabilities.

Another feature in 3.1 is Paramaterised Builds, providing the ability to override variables at the run time of a build. With this we have moved Global Variable storage into the database and introduced the concept of Plan Variables.

Deprecated Classes

Deprecated

Replacement. Notes

Builder & AbstractBuilder

TaskType. For more details on Tasks see our Tasks Overview page

Command

TaskType, ProcessService & ExternalProcessBuilder. For more details on Tasks see our Tasks Overview page

CommandDecorator

TaskType, TaskProcessCommandDecorator. For more details on Tasks see our Tasks Overview page

EnvironmentVariablesAwareBuilder & MutableEnvironmentVariablesAwareBuilder

TaskType, EnvironmentVariableAccessor and ExternalProcessBuilder. For more details on Tasks see our Tasks Overview page

PostConfigurableBuilder

TaskConfigurator, TaskRequirementSupport. For more details on Tasks see our Tasks Overview page

BuilderModuleDescriptor

TaskModuleDescriptor. For more details on Tasks see our Tasks Overview page

BuilderManager

TasksManager. For more details on Tasks see our Tasks Overview page

BuilderConfigHelper

No Direct Replacemet, however,  TaskConfiguratorHelper may be usefull. For more details on Tasks see our Tasks Overview page

LabelPathMap

TaskExecutableType & CapabilityDefaultsHelper. For more details on Tasks see our Tasks Overview page

Maven2LogHelper

MavenLogHelper

VariableSubstitutionBean

CustomVariableContext

MutableQuietPeriodAwareRepository

No Replacement. QuietPeriodAwareRepository is still valid

com.atlassian.bamboo.builder.Matcher

Logic included in MavenLogHelper. You may also be interested in the adding a LogInterceptor to the LogInterceptorStack in the BuildLogger

Deprecated Methods

Deprecated

Replacement. Notes

Bamboo.getBuilderManager()

inject TaskManager instead

BuildDefinition.getBuilder()

BuildDefinition .getTaskDefinitions()

BuildDefinition.setBuilder()

BuildDefinition .getTaskDefinitions.add()

BuildPlanDefinition .getBuilderV2()

BuildDefinition .getTaskDefinitions(). To get the BuildDefinition instead of BuildPlanDefinition use BuildContext .getBuildDefinition() instead of BuildContext .getBuildPlanDefinition()

UIConfigBean .getAllBuilders()

UIConfigBean .getExecutableLabels( String shortKey ). Requirements and Capabilities are not closely tied to Tasks. 
For more information on Requirements and Capabilities view our Tasks Overview page

UIConfigBean .getBuilderTypes()

UIConfigBean .getExecutableLabelTypeMap()

BambooPredicates .planHasBuilderOfKey( String builderKey )

BambooPredicates .isTaskDefiinitionPluginKeyEqual( @NotNull String pluginKey )

RequirementSet .getRequirement( @NotNull String key )

RequirementSet .getRequirement( String key, long ownerId )RequirementSet .getRequirement( long )
 RequirementSet .getRequirementsForPlugin( String pluginModuleKey, long ownderId )
where ownerId = taskDefinition id.

Notes: Requirements are now closely tied to the Task they belong to.  For more information on Requirements and Capabilities view our Tasks Overview page

RequirementSet .removeRequirement( @NotNull String key )

RequirementSet .removeRequirement( @NotNull Requirement requirment ).The key is no longer unique, use the above methods to obtain the correct Requirement to remove.

AdministrationConfiguration .setGlobalVariable()
AdministrationConfiguration .getGlobalVariable()
AdministrationConfiguration .getGlobalVariables()
Administration .removeGlobalVariable()
AdministrationConfiguration .getGlobalVariables()

VariableDefinitionManager. Variable storage have been moved from the administrationConfiguration.xml file into the database.  

RepositoryV2 .getSourceCodeDirectory( @NotNull String planKey )

RepositoryV2 .getSourceCodeDirectory( @NotNull PlanKey planKey )

BuildLogger .startStreamingBuildLogs( int buildNum, String planKey )

BuildLogger .startStreamingBuildLogs( @NotNull PlanResultKey planResultKey )

BuildsMovedEvent .getMovedBuilds()

BuildsMovedEvent .getMovedPlans()

ElasticInstanceManager .registerElasticAgentStarted()

ElasticInstanceManager .onInstanceIdentified()

FileCopier.copyFile()

org.apache.commons.io.FileUtils.copyFile()

ResultsSummaryManager .getAllResultSummariesForPlan( Plan plan )

ResultsSummaryManager .getResultSummaries( ResultsSummaryCriteria criteria )

Notes: This was deprecated due to performance issues.
ResultsSummaryCriteriaBuilder is available to aid creation of the ResultsSummaryCriteria

New Integration Points

Tasks

As mentioned above we have introduced Tasks. This is a new plugin point allowing you to easily create multiple execution steps in your Build. We've made writing new Task plugins incredibly easy. You can find all the information on creating Tasks on our Tasks Overview page.

Label Events

We now have ResultLabelAdded, ResultLabelRemoved, FavouriteAdded and FavouriteRemoved Events. You can listen for these events using an Event Listener Module.

Managing caches

Repository (or actually any other module) can implement CacheHandler to have its caches managed via Administration->Manage Caches page

Log interceptors

We've added infrastructure for analysing build logs on the fly. For documentation, see LogInterceptor.  You can add these interceptors to the LogInterceptorStack in the BuildLogger. For examples of usage, see com.atlassian.bamboo.build.logger.interceptors.StringMatchingInterceptor and com.atlassian.bamboo.plugins.ant.task.AntBuildTask .

Gravatar Support

Want to use people's avatars in your plugin? Just inject the GravatarService into your server side plugin, or use the FreeMarker macro:

1
2
[@ui.displayUserGravatar username="msmith" size="26"/]

Rate this page: