Last updated Mar 13, 2024

Bamboo API Changes for Bamboo 3.3

New integration points

Custom Build Definition Transformer

As of Bamboo 3.3, a new plugin module Custom Build Definition Transformer has been added. Module classes previously implementing the com.atlassian.bamboo.plugin.module.ext.BuildDefinitionTransformer interface will need to explicitly be declared in the plugin descriptor as modules of type 'Custom Build Definition Transformer' (see example declaration on the linked page).

Changes in the public API

Removed deprecated methods from AuthorDao and ExtendedAuthorManager

AuthorDao.java

1
2
/**
 * @param author
 * @return {@link List} of {@link BuildResultsSummary} triggered by author
 * @deprecated since 2.6 use the version with limited result count instead
 */
@Deprecated
List getBuildResultsTriggeredByAuthor(ExtendedAuthor author);

/**
 * @param author
 * @return {@link List} of {@link BuildResultsSummary} triggered by author and failed
 * @deprecated since 2.6 use the version with limited result count instead
 */
@Deprecated
List<ResultsSummary> getBuildResultsFailedByAuthor(ExtendedAuthor author);

/**
 * @param author
 * @return {@link List} of {@link BuildResultsSummary} triggered by author and succesful
 * @deprecated since 2.6 use the version with limited result count instead
 */
@Deprecated
List<ResultsSummary> getBuildResultsSuccessfulByAuthor(ExtendedAuthor author);

/**
 * @param author
 * @return {@link List} of {@link BuildResultsSummary} broken by author
 * @deprecated since 2.6 use the version with limited result count instead
 */
@Deprecated
List<ResultsSummary> getBuildResultsBrokenByAuthor(ExtendedAuthor author);

/**
 * @param author
 * @return {@link List} of {@link BuildResultsSummary} fixed by author
 * @deprecated since 2.6
 */
@Deprecated
List<ResultsSummary> getBuildResultsFixedByAuthor(ExtendedAuthor author);

ExtendedAuthorManager.java

1
2
/**
  *
 * Either retrieves an existing author (if exists) or creates a new one (if author does not exist)
 * for a given commit
 *
 * @param commit
 * @param authorName
 * @return {@link ExtendedAuthor} which made the commit.
 * @deprecated since 2.6  use {@link #createAndSaveAuthor(String)} when creating one or {@link #getAuthorByName(String)} when retrieving
 */
@Deprecated
ExtendedAuthor generateOrRetrieveAuthorFromCommit(Commit commit, String authorName);

/**
 * @param author
 * @return {@link List} of {@link BuildResultsSummary} triggered by author
 * @deprecated since 2.6 use the method with limited result count instead
 */
@Deprecated
List<ResultsSummary> findBuildResultsTriggeredByAuthor(ExtendedAuthor author);

/**
 * @param author
 * @return {@link List} of {@link BuildResultsSummary} triggered by author and successful
 * @deprecated since 2.6 use the method with limited result count instead
 */
@Deprecated
List<ResultsSummary> findBuildResultsSuccessfulByAuthor(ExtendedAuthor author);

/**
 * @param author
 * @return {@link List} of {@link BuildResultsSummary} broken by author
 * @deprecated since 2.6 use the method with limited result count instead
 */
@Deprecated
List<ResultsSummary> findBuildResultsBrokenByAuthor(ExtendedAuthor author);

/**
 * @param author
 * @return {@link List} of {@link BuildResultsSummary} fixed by author
 * @deprecated since 2.6 use the method with limited result count instead
 */
@Deprecated
List<ResultsSummary> findBuildResultsFixedByAuthor(ExtendedAuthor author);

Removed deprecated methods from BambooCollectionUtils

BambooCollectionUtils.java

1
2
/**
 * Creates a sorted mutable ArrayList consisting of input elements
 *
 * @deprecated since 3.0 use Ordering.sortedCopy
 *
 * @param elements    Elements to be copied
 * @param comparator  Comparator used for sorting
 * @return  Sorted mutable list consisting of input elements
 */
@Deprecated
public static <E> List<E> newArrayList(@NotNull Iterable<? extends E> elements, @NotNull Comparator<? super E> comparator)
{
    List<E> result = Lists.newArrayList(elements);
    Collections.sort(result, comparator);
    return result;
}

/**
 * Creates a sorted mutable LinkedList consisting of input elements
 *
 * @deprecated since 3.0 use Ordering.sortedCopy
 *
 * @param elements    Elements to be copied
 * @param comparator  Comparator used for sorting
 * @return  Sorted mutable list consisting of input elements
 */
@Deprecated
public static <E> List<E> newLinkedList(@NotNull Iterable<? extends E> elements, @NotNull Comparator<? super E> comparator)
{
    List<E> result = Lists.newLinkedList(elements);
    Collections.sort(result, comparator);
    return result;
}

Removed deprecated methods from Comparators

Comparators.java

1
2
/**
 * @deprecated since 3.0 use {@link #getBuildDateOrdering()}
 * @return {@link Ordering} object
 */
@Deprecated
@NotNull
public static Ordering<ResultStatisticsProvider> getBuildDateComparator()
{
    return BuildDateComparator.ORDERING;
}

/**
 * @deprecated since 3.0 use {@link #getDescriptionProviderOrdering()}
 * @return {@link Ordering} object
 */
@Deprecated
@NotNull
public static Ordering<DescriptionProvider> getDescriptionProviderComparator()
{
    return DescriptionProviderComparator.ORDERING;
}

/**
 * @deprecated since 3.0 use {@link #getNameProviderOrdering()}
 * @return {@link Ordering} object
 */
@Deprecated
@NotNull
public static Ordering<NameProvider> getNameProviderComparator()
{
    return NameProviderComparator.ORDERING;
}

/**
 * @deprecated since 3.0 use {@link #getNameProviderCaseInsensitiveOrdering()}
 * @return {@link Ordering} object
 */
@Deprecated
@NotNull
public static Ordering<NameProvider> getNameProviderCaseInsensitiveComparator()
{
    return NameProviderCaseInsensitiveComparator.ORDERING;
}

/**
 * @deprecated since 3.0 use {@link #getResultsSummaryNumberOrdering()}
 * @return {@link Ordering} object
 */
@Deprecated
@NotNull
public static Ordering<ResultsSummary> getResultsSummaryNumberComparator()
{
    return ResultsSummaryNumberComparator.ORDERING;
}

/**
 * @deprecated since 3.0 use {@link #getPlanNameResultOrdering()}
 * @return {@link Ordering} object
 */
@Deprecated
@NotNull
public static Ordering<ResultsSummary> getPlanNameResultComparator()
{
    return PlanNameResultsComparator.ORDERING;
}

New repository interfaces

Repository plugin supporting multiple repositories.

Multiple repository support introduced the need of checkout source by repository plugin to arbitrary directory passed to repository plugin. This directory is generally sub directory of job working directory.

Ability of repository plugin to checkout to passed arbitrary directory is marked by implementing CustomSourceDirectoryAwareRepository.

Interface contains only one additional method with one additional parameter.

1
2
/**
 * Repository that supports checkout to any directory.
 */
public interface CustomSourceDirectoryAwareRepository extends RepositoryV2
{
    /**
     * Checks out the latest source code from an appropriate repository to specified directory
     *
     * @param buildContext
     * @param vcsRevisionKey  - may be null if you want latest code
     * @param sourceDirectory - directory to checkout to
     *
     * @return vcsRevisionKey - the revision
     *
     * @throws RepositoryException
     */
    @NotNull
    String retrieveSourceCode(@NotNull BuildContext buildContext, @Nullable String vcsRevisionKey, @NotNull File sourceDirectory) throws RepositoryException;
}

Repository plugin that requires clean checkout

Repository plugin may request clean checkout based on plugin specific criteria.

Repository should implement in such case MandatoryCleanCheckoutAwareRepository and decide if Bamboo should clean checkout directory before checkout. Example of such repository in Bamboo is SVN repository and using svn export feature.

1
2
/**
 * Implement this interface if repository can be configured in a way that requires clean checkout at each build.
 */
public interface MandatoryCleanCheckoutAwareRepository
{
    boolean isCleanCheckoutRequired();
}

Repository plugin that requires additional revision information

Repository plugin may require to store and use additional revision information. Example of such plugin is Subversion repository plugin using externals.

Additional revision information is passed by PlanVcsRevisionData bean, which contain custom data blob, that is interpreted by repository plugin.

1
2
/**
 * Repository that uses additional information for change detection.
 */
@ExperimentalApi
public interface CustomRevisionDataAwareRepository extends Repository
{
    @NotNull
    public BuildRepositoryChanges collectChangesSinceLastBuild(@NotNull String planKey,
                                                               @NotNull PlanVcsRevisionData lastRevisionData) throws RepositoryException;
}

Repository plugin that provides advanced configuration options

Bamboo 3.3 introduces standard mechanism for advanced repository options. Advanced options are presented together with common advanced options on collapsible panel in repository configuration.

In order to hook into this panel, reposiotry plugin should implement AdvancedConfigurationAwareRepository interface. Both method specified in the interface are implemented in Abstract Repository class, so there is no need to implement them in every plugin. Plugin should provide however Freemarker template for such options defined in atlassian-plugin.xml file:

1
2
public interface AdvancedConfigurationAwareRepository
{
    @Nullable
    String getAdvancedViewHtml(@NotNull Plan plan);
    @Nullable
    String getAdvancedEditHtml(@NotNull BuildConfiguration buildConfiguration, @Nullable Plan plan);
}

In order to hook into this panel, reposiotry plugin should implement AdvancedConfigurationAwareRepository interface. Both method specified in the interface are implemented in Abstract Repository class, so there is no need to implement them in every plugin.

Plugin should provide additional template in module descriptor called "advancedEdit":

1
2
<repository key="svn" name="SVN Repository"
                     class="com.atlassian.bamboo.repository.svn.SvnRepository">
    <description>A Subversion Repository</description>
    <resource type="freemarker" name="edit" location="templates/plugins/repository/svnRepositoryEdit.ftl"/>
    <resource type="freemarker" name="advancedEdit" location="templates/plugins/repository/svnRepositoryAdvancedEdit.ftl"/>
    <resource type="freemarker" name="view" location="templates/plugins/repository/svnRepositoryView.ftl"/>
  </repository>

Changed Repository interfaces

com.atlassian.bamboo.v2.build.repository.RepositoryV2

Before 3.3

1
2
BuildChanges collectChangesSinceLastBuild(@NotNull String planKey, 
@Nullable String lastVcsRevisionKey) throws RepositoryException;

After 3.3

1
2
@NotNull
BuildRepositoryChanges collectChangesSinceLastBuild(@NotNull String planKey, @Nullable String lastVcsRevisionKey) throws RepositoryException;

Before 3.3

1
2
String retrieveSourceCode(@NotNull String planKey, @Nullable String vcsRevisionKey) throws RepositoryException;

After 3.3

Removed

Before 3.3

1
2
File getSourceCodeDirectory(@NotNull PlanKey planKey) throws RepositoryException;

After 3.3

Deprecated

1
2
@Deprecated
File getSourceCodeDirectory(@NotNull PlanKey planKey) throws RepositoryException;

Before 3.3

1
2
boolean referencesDifferentRepository();

After 3.3

Deprecated

1
2
@Deprecated
boolean referencesDifferentRepository();

com.atlassian.bamboo.repository.Repository

Before 3.3

1
2
void setReferencesDifferentRepository(boolean isDifferentRepository);

After 3.3

Deprecated

1
2
@Deprecated
void setReferencesDifferentRepository(boolean isDifferentRepository);

com.atlassian.bamboo.repository.AbstractRepository

Before 3.3

1
2
@Override
@NotNull
public File getSourceCodeDirectory(@NotNull PlanKey planKey) throws RepositoryException
{
    ...
}

After 3.3

Deprecated

1
2
@Override
@NotNull
@Deprecated
public File getSourceCodeDirectory(@NotNull PlanKey planKey) throws RepositoryException
{
    ...
}

Deprecated Repository interfaces

Two interface has been deprecated: CleanCheckoutAwareRepository and CleanWorkingDirectoryAwareRepository.

Interfaces were deprecated, as "Force clean build" and "Clean working directory after each build" options has been moved from repository configuration to Checkout task configuration and Miscellaneous Job configuration. Options are handled now internally by Bamboo not by repository itself.

Rate this page: