Bamboo 2.1 : Common Bamboo Classes
This page last changed on Aug 24, 2008 by bmccoy.
This page outlines some of the more commonly used classes in Bamboo plugins and what sort of information you can retrieve from them The BuildContextEvery 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:
BuildPlanDefinitionThe 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.
RepositoryThe 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
Current Build ResultsThe 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:
BuildThe 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 ResultA 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/. BuildResultSummary
BuildResult
AdministrationConfigurationThe 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"); } AdminErrorHandlerThe AdminErrorHandler error handler is responsible for dealing with errors that occur while build 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; } |
![]() |
Document generated by Confluence on Mar 02, 2009 18:52 |