Documentation for Bamboo 4.0.x. Documentation for earlier versions of Bamboo is available too.

Plan branches are used to represent a branch in your version control repository, where the plan branch uses the same build configuration as your plan.

Tools such as Git and Mercurial encourage a practice called feature branching, where a developer can use a new branch to work in isolation from his or her team members before merging their changes back into main line development. This guarantees that their new code functions correctly before sharing the changes with the rest of the team.

However, changes made on a branch may not be built and tested by Bamboo unless the developer sets up a new  build plan, or clones an existing plan that is configured to build the new branch. When using plan branches, any new branch that is created is automatically built and tested using the build configuration of the plan that plan branches was enabled for. Optionally, changes from the feature branch can be merged back to the "master" (e.g. trunk, default or mainline branch).

Note that you need to 'favourite' a plan branch in order to receive notifications about build results for it.

計画のブランチングを有効化する

When you activate plan branching, Bamboo automatically creates branches whenever the source repo is branched. You can also create a plan branch manually.

Whichever way the plan branch is created, the default plan maintains the structure and configuration of it's branch plans. However, you can override the following settings in a branch plan:

  • the source repository, so that the branch uses a different repository from the default plan.
  • the plan variables, so that the branch uses different variables from the default plan.

To see a list of branches for a plan, click on the branch icon beside a plan name on the All Plans tab. Select a branch name from the list to go directly to the summary page for that branch plan.

You can click Detect Branches to get Bamboo to check for branches in the specified repository for the plan.

自動ブランチング

Use auto branching for Git and Mercurial repositories. For other repository types, use manual branching.

To have Bamboo automatically create a branch plan whenever the repo branches:

  1. ブランチを作成する計画の設定ページの [ブランチ] タブに移動します。
  2. Select Enabled, under 'Automatic Branch Detection'.
  3. Enter a regular expression to specify the repo branch names for which plan branches will be created. See the Java documentation on regular expressions.
  4. Select Enabled, under 'Automatic Branch Clean-up', if required.
  5. 保存をクリックします。

(info) Please note that 'Automatic Branch Clean-up' is supported for Mercurial, Git (Bamboo 4.1.1 and above) and Subversion (Bamboo 4.2.0 and above).

 

手動ブランチング

Use manual branching for all supported repository types. You can use auto branching for Git and Mercurial repositories.

計画のブランチを手動で作成するには、次の手順を実行します。

  1. ブランチを作成する計画の設定ページの [ブランチ] タブに移動します。
  2. Click Create Branch.
  3. 利用可能な VCS ブランチから選択して、[作成] をクリックします。
  4. Select Override default's Repository in the Source Repository tab if you want the branch plan to use a different repository from the default plan. See Specifying the source repository and it's child pages for details.
  5. Click the Variables tab to override the plan variables of the default plan.

スクリーンショット: ブランチの [Plan Summary (計画の要約)] ページに「ブランチ」メニューが表示されている。

自動マージの使用

ブランチのマージを自動化する場合、Bamboo には 2 つのマージ モデルが用意されています。

  • ブランチ アップデーター - ブランチ リポジトリが master の変更に応じて最新の状態に保たれます。
  • Gatekeeper — the master repo is only updated with changes in the branch that have built successfully.

 

ブランチ アップデーター

使用環境

ブランチ アップデーターは、次のような場合に使用してください。

  • Automatically merge changes from the team's master branch into your feature branch, after a successful build of the master branch.
  • フィーチャー ブランチの変更がチームの master ブランチに対応しなくなった際に通知を受け取ります。

設定

別のリポジトリの最近の変更をブランチ リポジトリに統合するには、次の手順を実行します。

  1. ブランチ計画の設定ページの [ブランチの詳細] タブに移動します。
    ([すべての計画] タブで計画名の横にあるブランチ アイコンをクリックして、[アクション] > [ブランチを設定] を選択します。)
  2. Select Branch Integration Enabled, and then click Branch Updater.
  3. [Merge From (マージ元)] リストを使用して、フィーチャー ブランチにマージする変更が行われるリポジトリを選択します。
  4. Select Push only if you want those changes merged back into your branch once the build completes successfully,
  5. 保存をクリックします。

Gatekeeper

使用環境

ゲートキーパーは、次のような場合に使用してください。

  • 両方のブランチからマージされた変更が正常にビルドされた後、フィーチャー ブランチをチームの master ブランチに自動でマージします。
  • 両方のブランチから結合された変更のビルドが失敗した際に通知を受け取り、フィーチャー ブランチがチームの master ブランチに再マージされないようにします。

設定

正常にビルドされた変更を別のリポジトリにプッシュするには、次の手順を実行します。

  1. ブランチ計画の設定ページの [ブランチの詳細] タブに移動します。
    ([すべての計画] タブで計画名の横にあるブランチ アイコンをクリックして、[アクション] > [ブランチを設定] を選択します。)
  2. Select Branch Integration Enabled, and then click Gate Keeper.
  3. [チェックアウト] リストを使用して、変更をマージする (同時に変更のプッシュ先となる) リポジトリを選択します。
  4. Select Push only if you want your changes pushed to the other repo once the build completes successfully,
  5. 保存をクリックします。

計画ブランチの制限事項

計画の自動ブランチングおよびマージには、次の制限が適用されます。

操作制限事項
計画の自動ブランチング
  • Can only be used with Git and Mercurial repositories. For other repository types, use manual branching.
  • Cannot be used with the Git implementation embedded in Bamboo. (You need to have set up native Git.)

計画の手動ブランチング

  • Bamboo でサポートされているすべてのリポジトリ タイプで使用できます。
ブランチの自動マージ
  • Git および Mercurial リポジトリでのみ使用できます。
  • Bamboo で設定されたブランチでのみ使用できます。
  • Cannot be used with the Git implementation embedded in Bamboo. (You need to have set up native Git.)
Plan Branches with multiple repositoriesSee Is it possible to use plan branches to override the branch on multiple repositories in a plan? on Atlassian Answers.
  • ラベルなし