4

I have 3 different repositories which has to be deployed(deploymentType is Blue/Green) to same autoscaling group. I've created 3 different code pipeline and one deployment group.

Problem here is Blue/Green deployment will create new autoscaling group using the AMI-id provided in Launch Template, so at a time only one branch will be there in the instance.

As all 3 repos code is required for the Web App to function. As I don't want to create new autoscaling groups for all 3 repos. I thought of doing it like this:

Dummy Branch A:

ProjectName
- Repo1Project
- Repo2Project
- Repo3Project
- appspec.yml
- attach-target-group-to-alb.sh

and in 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

Update each folder by using this command:

To merge only specific file/folder from other branch to current

git checkout Repo1ProjectBranch ProjectName/Repo1Project

git commit -m "Your comment"

And then push it to actual BranchB

But I'm not sure if this is valid way of doing it, or there is any other better solution. So thought of posting it here if anyone has already found better solution.

Greeshma
  • 186
  • 1
  • 5

0 Answers0