Bitbucket Server

On this page

Still need help?

The Atlassian Community is here for you.

Ask the community

This page describes how to configure Bamboo to use a Bitbucket Server repository.

You can specify repositories at the following levels in Bamboo:

  • global – repositories are available to all plans in Bamboo.
  • plan – repositories are available to all jobs in the Bamboo plan.
  • job – repositories are available to all tasks in the Bamboo job.

The recommended approach is to set up linked source repositories at the global level – see Linking to source code repositories.

When you link a repository hosted in Atlassian's Bitbucket Server with a build plan in Bamboo, then without any further configuration:

  • Bamboo will automatically run a build when changes are pushed to the Bitbucket Server repository, without needing to configure polling.
  • Bamboo will automatically update plan branches when a developer pushes a new branch to the repository (or deletes a branch).
  • You can click through to Bitbucket Server to see the commit diff for all files that are part of the changeset.
  • Bitbucket Server commits that are part of a build are displayed in Bamboo.
  • Build results are notified to Bitbucket Server (and displayed for the associated commits and pull requests).

On this page:

Bitbucket Server and Bamboo only need to have been connected by creating an application link. Repositories in Bitbucket Server are then made available in Bamboo, so it is easy for you to link your Bamboo plan to a Bitbucket Server repository.

When you create a plan that uses a Bitbucket Server source repository, Bamboo will automatically use the 'Bitbucket Server repository triggers the build when changes are committed' trigger option instead of using the 'polling the repository for changes' option. This reduces the load on the Bamboo and Bitbucket servers because Bamboo doesn't need to send poll requests (for each branch of each plan) to the Bitbucket server every 3 minutes (the default polling period). Instead, Bitbucket Server will trigger Bamboo whenever there is a push to the repository.

 

Configuration requirements

Navigate to the source repository settings for a plan or job, as described on Linking to source code repositories, then:

  1. Either click Add Repository to add a new repository, or edit an existing repository configuration.
  2. Choose Stash from the Repository host list.

  3. Complete the required information:

    Display nameA name that identifies this repository within Bamboo.
    Stash serverThis menu will show all Bitbucket servers that have been linked to Bamboo via an application link.
    RepositoryThe repository that will be built. This menu will show all repositories on the Bitbucket server that you have permissions to access.
    BranchPick a branch if you want to check out code from a branch other than the default branch.


    Advanced options

    Use shallow clonesAllows Bamboo to perform shallow clones (i.e. history truncated to a specified number of revisions). This should increase the speed of the initial code checkouts, however if your build depends on the full repository history, we recommend that you do not use this option. Shallow clones are enabled by default.
    Enable repository caching on remote agentsAllow caching of repositories on remote agents to save bandwidth. Note that caches are always full clones of the source repository.
    Use submodulesSelect to enable submodules support if these are defined for the repository. If native Git capability is not defined for agent submodules support will be disabled.
    Command timeoutThis helps to stop hung Bitbucket processes. On slower networks, you may consider increasing the default timeout to allow Bamboo time to make an initial clone of the Git repository.
    Verbose logsTurns on more verbose logs from Git commands. Use this option if you encounter problems with Git in Bamboo.
    Fetch whole repositoryFetches whole repository instead of only one selected branch.
    Enable Quiet PeriodSpecifies a delay after a single commit is detected before the build is started. This allows multiple commits to be aggregated into a single build.
    Include/Exclude Files

    Allows you to specify the files that Bamboo should, or should not, use to detect changes. When you configure the Include option, it means that you want Bamboo to use only the mentioned files for change detection (by default Bamboo checks all the files). In the same way, if you configure the Exclude option, Bamboo will not consider the excluded files when detecting changes.

    Enter into File Pattern a regular expression to match the files that Bamboo  includes or excludes. The regex pattern must match the file path in the repository. See this page for examples.

    Exclude changesetsEnter a regular expression to match the commit messages for changesets that should not start a build.
    Web repository

    If your repository can be viewed in a web browser, select the repository type.

    This allows links to relevant files to be displayed in the 'Code Changes' section of a build result.

    Stash – specify the following details for the repository:
      • Server URL – the URL of your Bitbucket Server instance (e.g. 'https://bitbucket.mycompany.com ').
      • Stash Project Key – the key of the project in Bitbucket Server (e.g. 'CONF').
      • Repository Name – the name of the repository in Bitbucket Server (e.g. 'conf-dev').

     

    See Integrating Bamboo with Bitbucket Server for more information.

 

Last modified on Jan 20, 2017

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.