"変更がコミットされるとリポジトリがビルドをトリガーする" という設定は、Bamboo サーバーの負荷を最小限に抑えるという利点があります。ただし、ソース リポジトリが Bamboo サーバーにイベントを発生させるように設定されている必要があります (設定した計画は "リッスン" します)。
変更がコミットされるとリポジトリがビルドをトリガーするように設定するには、次の 2 つの変更が必要です。
- Configuring your source repository, and
- Configuring Bamboo to trigger a build on code check in.
Step 1. Configuring your Source Repository
To configure your source repository:
- Configure your source code management system's repository to send post-commit event messages which tell Bamboo to commence building plans that use this repository. These event messages are sent whenever a code commit has occurred.
- For CVS, edit two files in the CVSROOT module:
commitinfo and loginfo.
- For
commitinfo add a line like this:
ここで、「jira」は自分のモジュールです。
- For
loginfo add a line like this:
ここで、JIRA-MAIN と JIRA-BRANCH はトリガーする Bamboo 計画、JIRA はプロジェクト キー、BRANCH または MAIN は計画キーです。
- For Subversion, edit the Subversion respository's
hooks/post-commit trigger file with something like:
- For Perforce, add the script as a change-commit trigger.
- For Git, edit the Git respository's
.git/hooks/post-receive trigger file with something like:
For more details about configuring these message events for CVS and Subversion, please refer to Configuring Source Code Management Triggers for Subversion.
- Copy the scripts to your repository. If you are using Bamboo Standalone, the scripts are located in the
/scripts folder of your Bamboo Installation Directory. If you are using Bamboo EAR-WAR you can find them in the /repositoryScripts folder. You can also download the scripts by following this link.
- リポジトリが実行されているオペレーティング システムによっては、スクリプトの編集が必要になることがあります。スクリプトは、「
wget」が「/usr/bin/」にあると仮定します。これが自分のリポジトリに当てはまらない場合 (たとえば Solaris 10 では /usr/sfw/bin/ にある)、スクリプトを編集して、「/usr/bin/」を適切な場所に変更します。
- Bamboo を実行しているユーザーが、スクリプトを実行する適切なファイル権限を持っていることを確認します。つまり、スクリプトは非 root ユーザーでも実行可能でなければなりません。
- Enable Bamboo's remote API so that the scripts can use Bamboo's REST-style remote API to access Bamboo's data.
Step 2. Configuring Bamboo to Trigger a Build on Code Check In
始める前に
- Triggering a build when there is no update — Bamboo will ignore the build triggers, if the local working copy and the repository copy have the same revision numbers. When testing your build triggers, please check that the local working copy is not the latest version - in which case, no further action will be taken.
コードのチェック インでビルドをトリガーするように Bamboo を設定する方法は次のとおりです。
- Navigate to the repository settings for desired Plan, as described on Specifying the Source Repository for a Plan.
- In the 'Build Strategy' field, select 'Repository triggers the build when changes are committed', which displays the 'Trigger IP Address' field (see screenshot below).
- If you want Bamboo to receive post-commit notifications from the repository's primary IP address, leave the 'Trigger IP Address' field blank. If you want Bamboo to receive post-commit notifications from a different IP address, type the IP address in the 'Trigger IP Address' field.
- 「保存」ボタンをクリックします。

Screenshot above: Build Strategy: Repository triggers the build when changes are committed
注意
Triggering a Plan Build when Code is Updated
Polling the Repository for Changes