同じ自動スケーリング グループにデプロイする必要がある 3 つの異なるリポジトリ (deploymentType は Blue/Green) があります。3 つの異なるコード パイプラインと 1 つのデプロイ グループを作成しました。
ここでの問題は、Blue/Green デプロイメントが起動テンプレートで提供された AMI-id を使用して新しい自動スケーリング グループを作成するため、一度に 1 つのブランチしかインスタンスに存在しないことです。
Web アプリが機能するには、3 つのリポジトリ コードがすべて必要です。3 つのリポジトリすべてに対して新しい自動スケーリング グループを作成したくないためです。私はこのようにすることを考えました:
ダミー分岐 A:
ProjectName
- Repo1Project
- Repo2Project
- Repo3Project
- appspec.yml
- attach-target-group-to-alb.sh
および appspec.yml で:
version: 0.0
os: linux
files:
- source: ProjectName/Repo1Project
destination: /var/www/html/Repo1Project
- source: ProjectName/Repo2Project
destination: /var/www/html/Repo2Project
- source: ProjectName/Repo3Project
destination: /var/www/html/Repo3Project
hooks:
BeforeInstall:
- location: Repo1Project/Scripts/pre_install.sh
- location: Repo2Project/Scripts/pre_install.sh
- location: Repo3Project/Scripts/pre_install.sh
timeout: 600
runas: ec2-user
AfterInstall:
- location: Repo1Project/Scripts/post_install.sh
- location: Repo2Project/Scripts/post_install.sh
- location: Repo3Project/Scripts/post_install.sh
timeout: 600
runas: ec2-user
AfterAllowTraffic:
- location: attach-target-group-to-alb.sh
timeout: 600
runas: ec2-user
次のコマンドを使用して、各フォルダーを更新します。
特定のファイル/フォルダーのみを他のブランチから現在のブランチにマージするには
git checkout Repo1ProjectBranch プロジェクト名/Repo1Project
git commit -m "あなたのコメント"
そして、それを実際のBranchBにプッシュします
しかし、これが有効な方法なのか、それとも他のより良い解決策があるのか はわかりません。誰かがより良い解決策をすでに見つけている場合は、ここに投稿することを考えてください。