Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In AWS Codestar, how to configure branch deployments to specific environments?

I just created a brand new AWS Codestar project.

As far as I can tell, that Codestar is just a dashboard that integrates multiple AWS products.

There is one thing that I don't know how to configure yet, and it is branch deployments.

In my git repository, I have 3 branches: master, develop and staging

In an ideal world, master deploys to production, develop to the development environment and staging to the QA environment.

I don't know how to configure this pipeline using AWS, and I haven't been able to locate to relevant documentation in their developers portal.

This is my buildspec.yml file just in case it can be configured there:

version: 0.2

phases:
  install:
    commands:
      - echo Installing NPM Packages...
      - npm install
  build:
    commands:
      - aws cloudformation package --template template.yml --s3-bucket $S3_BUCKET --output-template template-export.yml

artifacts:
  type: zip
  files:
    - template-export.yml

This is a project that uses AWS API Gateway to route requests to AWS Lambda functions if that matters.

like image 484
ILikeTacos Avatar asked Sep 23 '17 22:09

ILikeTacos


1 Answers

Sadly AWS CodePipline doesn't support passing in the git branch. Last year they have only added support to pass the git commit sha1 (more can be found here).

I'd suggest you follow the CodePipline docs here, to create 3 pipelines one for each branch (you can even create a special buildspec_dev.yaml or buildspec_prod.yaml, check out more examples here).

like image 77
mostafazh Avatar answered Nov 19 '22 03:11

mostafazh