Skip to end of metadata
Go to start of metadata


Using the source repository to trigger the build of a plan is one of the available methods for triggering builds in Bamboo.


"Repository triggers the build when changes are committed" has the advantage of placing minimal load on your Bamboo server. However, it requires that your source repository is configured to fire an event to the Bamboo server (which the configured Plan will 'listen for').


Configuring the repository to trigger the build when changes are committed requires two changes:


The overall process is: a commit to the repository causes a post-commit message to be sent to Bamboo. Bamboo responds by checking the repository for unbuilt changes. If changes are found, Bamboo triggers a build.

1. Configuring your source repository

Configure your source code management system's repository to send post-commit event messages to Bamboo. These messages tell Bamboo to begin building the plans that use this repository.

 For Bitbucket, click here to expand...

Add the Bamboo hook to your repository in Bitbucket. No further action is necessary on your local repository. Each push of new commits in to Bitbucket will trigger the build based on your configuration. 

 For Stash, click here to expand...

 When you create a plan that uses a linked Stash repository, with Stash 3.1 and later, Bamboo uses the 'Stash repository triggers the build when changes are committed' trigger option by default.

 For Git, click here to expand...

 Edit the Git respository's .git/hooks/post-receive trigger file with something like:

/pathto/ http://bambooserver JIRA-MAIN JIRA-BRANCH

For Git, use the SVN script. See below for more information about the scripts.

 For Mercurial, click here to expand...

 Edit the Hg respository's .hg/hgrc settings file with something like:

changegroup.update = /pathto/ http://bambooserver JIRA-MAIN JIRA-BRANCH
See below for more information about the scripts.
 For Subversion, click here to expand...

If you are using a remote SVN server, copy file "atlassian-bamboo/repositoryScripts/svn-triggers/" to the SVN repository .../hook/post-commit folder so that the file can be accessible from post-commit trigger file.

Edit the Subversion repository's hooks/post-commit trigger file with something like:

/pathto/ http://bambooserver JIRA-MAIN JIRA-BRANCH

See below for more information about the scripts. Please refer to Configuring source code management triggers for Subversion.

 For Perforce, click here to expand...

 Add the script as a change-commit trigger.

triggerName change-commit //myDepot/... "/usr/local/bin/ http://bambooServer/ MYPLAN-DEFAULT"
See below for more information about the scripts.
 For CVS, click here to expand...

 Edit two files in the CVSROOT module: commitinfo and loginfo.

  • For commitinfo, add a line like this:

    ^jira(/|$)  /pathto/

    where "jira" is your module.

  • For loginfo, add a line like this: 

    ^jira(/|$) /pathto/ %{} http://bambooserver JIRA-MAIN JIRA-BRANCH

    where JIRA-MAIN and JIRA-BRANCH are the Bamboo plans that you would like to trigger, JIRA being the project key and BRANCH or MAIN being the plan key.

See below for more information about the scripts. Please refer to Configuring source code management triggers for Subversion.


  • You can download the scripts using this link. Use the same SVN script for Git. Copy the scripts to your repository. The scripts can also been found in the /scripts folder of your Bamboo Installation Directory

  • Depending on which operating system your repository is running on, you may need to edit the scripts. The scripts assume that 'wget' is in '/usr/bin/'; if this isn't the case for your repository (e.g. Solaris 10 has it in /usr/sfw/bin/), edit the scripts and change '/usr/bin/' to the appropriate location.
  • Ensure that the user which Bamboo is running as has appropriate file permissions to execute the scripts, i.e. the scripts should be executable by non-root user(s).

2. Configuring Bamboo to respond to post-commit messages

Before you begin:

  • Triggering a build when there is no repository update — Bamboo will ignore build triggers if the local working copy and the repository copy have the same revision numbers. When testing your build triggers, ensure that the local working copy is not the latest version - if this is the case, Bamboo will take no further action. 
  • If you're using the Bitbucket Bamboo post-push hook, ensure that the user you are using to authenticate triggering the build has the 'build' permission on the plan you are attempting to trigger. 

To configure Bamboo to trigger a build on code check in:

  1. Click Dashboard and then the All Plans tab.
  2. Locate the plan in the list and click the edit icon to display the plan's configuration pages.
  3. Click the Triggers tab, then click either an existing trigger or Add Trigger.
  4. Optionally, enter a trigger description.
  5. Choose Trigger type > Repository triggers the build when changes are committed.
  6. Bamboo displays the available repositories for the plan, as previously configured on the Source Repositories tab. Choose the repositories that this trigger should apply to.
  7. Only enter an IP address in Trigger IP Addresses if you want Bamboo to trigger on post-commit messages from other than the primary IP address for the repository.

    If you use a Mercurial or Git repository then you must type the IP address of your repository host in Trigger IP Addresses. For Bitbucket the current outbound IP addresses can be found at Access Bitbucket from Behind a Firewall

  8. Click Save Trigger.

Screenshot: Build Strategy – repository triggers the build when changes are committed


  1. Anonymous

    What does JIRA-MAIN and JIRA-BRANCH mean in the git post-receive example?

    1. Anonymous

      Ah, it's explained in the CVS example:
      where JIRA-MAIN and JIRA-BRANCH are the Bamboo plans that you would like to trigger, JIRA being the project key and BRANCH or MAIN being the plan key. 

    2. Anonymous

      That is the BUILD-KEY.  The BUILD-KEY is the key of the Bamboo plan to be executed (from Configuring source code management triggers for Subversion). 

      The easiest way I found to find the BUILD-KEY is to:  login to bamboo -> select the project -> click to edit the plan you want to trigger.  Now look at the url.  It should look something like http://<host>:<port>/chain/admin/config/defaultStages.action?buildKey=XX-XXX  where XX-XXX is what you want to replace JIRA-MAIN in the example with. 

  2. Anonymous

    Is anybody has the Git post-receive script to trigger bamboo build? I don't seem to see it on the Bamboo installation folder. There scripts for SVN, CVS, and Perforce, but no Git.

  3. Which script are you talking about? If you need then you can steal it from the SVN folder and re-use it for Git's post-receive hook. Unless I'm mistaken and it won't work - what problem exactly are you encountering?

  4. can someone please just explain what to add to updateAndBuild.action?buildKey=

    is it simply the plan name? it doesn't seem to work.

    I entered http://ciserver:8085/updateAndBuild.action?buildKey=TEST-TEST1 and i get a blank page with a bamboo header (dashboard, authors, reports) nothing happens internally. no build is starting.

    1. Hm... it could be that your Bamboo server is ignoring the request because it comes from a non-whitelisted IP. Can you double check your configuration, whether you have "Trigger IP Addresses" field configured properly (it should have IP of the server from which the call will be made - either your machine (if you do the manual attempt with web browser) or the machine hosting Hg repository (if you manage to plug wget/curl/other_tool into Mercurial hook on Windows)).



      1. I had the IP set up, but when i remove it from bamboo, i get the same page but now it says my IP isn't valid. i added it back in and the blank page appears again. I then tried again, but now (whoda thunk?) i added some changes to the repo first, and the build starts. would be nice with some feedback though.

  5. Anonymous

    I am also facing the same issue and and bamboo returns a blank page when I hit http://<host>:<port>/build/updateAndBuild.action?buildKey=<ABC>

    What changes I need to do in order to be working?

  6. So, when the script springs the trigger, bamboo checks the repository for commits as-of-yet-unbuilt.  When testing the trigger, I must commit a change first or bamboo will appear to do nothing.  It is really checking with the repo to see if there is work to do.

    1. Correct, Peter. I'll add your comment into the page.

  7. How does one trigger the build now with the REST API? The remoting API has been removed, and the docs there point towards teh REST API.


    Thanks, David

  8. Anonymous

    How can you allow a trigger from a subnet of addresses? I know how to do multiple IPs, but I'd rather have a subnet of IPs allowable. 

  9. One thing which took me ages to figure out... you need to have anonymous access enabled for the plan you're trying to trigger the build for. If you don't, the script will just receive a login page in response and nothing else will happen.

    1. This actually not the case. Depending on which service you have configured to notify Bamboo, you can use your credentials over http to authenticate using basic authentication.

  10. Is there any way to preserve the name of the user that effectively triggered the build? At the moment, bamboo says that every build was triggered by the same user (in my case, "GitHub user"). It would be nice if bamboo would show the name of the user who committed the change which triggered the build.

  11. I would like to configure the repository for git but I'm not able to find where "" is. Can anyone help me, please?

    1. Sendami, you can use the SVN script for Git. You'll find it in:

      <Bamboo install directory>/scripts/svn-triggers

  12. Hi,

    how to have TFS trigger the plan? I have downloaded and added the add on for TFS repository for trial.

    Please suggest.