ブランチからのデプロイ

ブランチ デプロイとは

ブランチは開発プロセスにおける重要なツールであり、ソフトウェア プロジェクトのさまざまな側面で開発者を孤立して作業できるようにする非常に強力な方法を提供します。

計画ブランチは、バージョン管理システム内のブランチ用のビルドを表します。計画ブランチは、親計画で定義された設定すべてを継承します。作成された新しいブランチは、親と同じビルド設定を使用して自動的にビルドおよびテストされます。計画ブランチのビルドが成功すると、自動または手動でマスターにマージして戻すことができます。

ブランチ デプロイは、ユーザーが任意の計画ブランチからデプロイ リリースを作成できるようにすることで、計画ブランチを拡張します。

Learn more about branching strategies: Bamboo Best Practice - Branching and DVCS.

ブランチ デプロイを使うべき理由

Bamboo のデプロイでは、機能コードがマスターにマージして戻される前に、計画ブランチをリスクの低いテスト環境にデプロイできます。つまり、開発者が変更をマスターにマージして戻す前に、機能コードを実際のサーバー環境で入念にテストして評価することが可能です。

開発者は、進行中の開発コードをマスター コードと分けながら、デプロイ可能な環境内でそのコードをテストしたい場合、ブランチ デプロイを使用することを検討する必要があります。

デプロイ リリースデプロイ リリースの仕組みに関する詳細をご確認ください。

以下の図は、典型的なデプロイ ブランチの例を示しています。

  1. 開発者がマスターから新しいブランチを作成すると、Bamboo の新しいブランチ用に計画ブランチが自動的に作成されます。
  2. 開発者がブランチに対してコードをコミットすると、計画ブランチは自動的に変更をビルドします。
  3. ビルドが成功したら、ビルド #3 と#4 の結果をテスト環境にデプロイして入念なテストを実施します。
  4. テストすべてに合格したら、開発者は手動で機能ブランチをマスターにマージして戻します。
  5. Now that the changes are in master – sporting the new feature – a new release can be created and deployed to the mainline environments (e.g. QA, Staging, and Production)

ブランチ デプロイのユースケース

Branch deployments should only ever be triggered into safe testing environments - they should never be triggered into production-like environments such as Staging, QA, or Production.

デプロイ プロジェクトの作成と構成に関する詳細をご確認ください。

ブランチ デプロイを管理する一般的な戦略は 2 つあります。

  1. 手動でのブランチ デプロイ
  2. 自動ブランチ デプロイ

それぞれの戦略を詳しく見ていきましょう。

手動でのブランチ デプロイ

開発者が計画ブランチを使用して製品の新機能に取り組んでいるとします。現状の開発段階では、新しいコードをサーバー環境でテストする必要があります。

  1. The developer successfully builds and tests the code using Bamboo. Let's call this Build #1.
  2. When a successful build occurs, it's ready to deploy by creating a new release for Build #1 and deploying it to the testing environment.
    Manual branch deployment preview

  3. デプロイすると、開発者は新しいコードを入念にテストします。テストすべてに合格したら、開発者は変更をマスターにマージして戻すことができます。

手動でデプロイを開始する方法の詳細をご確認ください。

自動ブランチ デプロイ

計画ブランチを使用して製品の新機能に取り組んでいる別の開発者について考えてみましょう。この開発者は、手動でトリガーされないように、ブランチ デプロイを自動化することにしました。

  1. The developer successfully builds the code, including the new code they have been working on. Let's call this Build #2.
  2. The developer doesn't want to deploy manually, so they use Bamboo's automated triggering to set up a strategy to deploy the plan branch into a deployment test environment. Two options are available:
    1. use Bamboo's scheduled trigger to deploy at a specified time and date:
      Scheduled trigger for build deployment configuration screen

    2. ビルド計画が正常に完了したら、Bamboo を使用してデプロイをトリガーする。
      Successful build trigger for build deployment configuration screen

  3. The developer sets up the triggering strategy to best match working practices. Once the trigger is reached, the plan branch build is deployed to the test environment.
  4. When the plan branch build is deployed, the developer thoroughly tests their new code. When satisfied that all of the tests have been passed, the developer can merge the changes back into master.

考慮事項: 計画ブランチのコードをマスターにマージして戻すには、ブランチ機能コードのテストが正常に完了する必要があります。

デプロイ環境のトリガーに関する詳細をご確認ください。

最終更新日 2021 年 8 月 17 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.