Configuring Git Repository to trigger the build in a Windows environment

Still need help?

The Atlassian Community is here for you.

Ask the community

This article is a guideline to configure a Git repository to trigger a Bamboo build in Windows.  The steps are mainly covered in: Repository triggers the build when changes are committed, but due to different default settings and commands in a Windows environment, there are some differences.  The overall process is: a commit to the repository causes a post-commit message to be sent to Bamboo. Bamboo then responds by checking the repository for un-built changes. If changes are found, Bamboo triggers a build.

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

Configuring your source repository

  1. Copy the scripts to your repository. If you are using the Bamboo distribution, the scripts are located in the /scripts folder of your Bamboo Installation Directory. If you are using Bamboo EAR-WAR distribution, you can find them in the /repositoryScripts folder. You can also download the scripts by following this FIZME link.
  2.  Edit the Git respository's .git/hooks/post-commit trigger file with something like: /pathto/postCommitBuildTrigger.py http://bambooserver MYTESTPROJECT-MYTESTPLAN. In "MYTESTPROJECT-MYTESTPLAN", MYTESTPROJECT is the project name in Bamboo and MYTESTPLAN is the plan name. Make sure that Python 2.X is installed. Also, since the hook will look for python under the default path "/usr/bin/python" add the path to the python executable in the beginning. Also, use use double quotation marks for local paths. 

    Example: 
    In this example "C:\Users\ssetayeshfar\hello" is the path to my local git repository. The "postCommitBuildTrigger.py" from under svn-triggers should be used. 

    "C:\Python27\python.exe" "C:\Users\ssetayeshfar\hello\svn-triggers\postCommitBuildTrigger.py" http://localhost:8085 MYTESTPROJECT-MYTESTPLAN

  3. 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).

Configuring Bamboo to respond to post-commit messages

Before you begin:

  • Triggering a build when there is no repository update — Bamboo will ignore build triggering requests if there are no changes committed to the repository branch, which is configured for the particular Bamboo plan.

To configure Bamboo to trigger a build:

  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.

Last modified on Nov 8, 2018

Was this helpful?

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