How to deploy every branch I push to my CodeCommit repo

0

I have a pipeline on CodePipeline that checks the master branch on a repo on CodeCommit. Every time there's a change in the master branch, the branch is deployed to my production stack. Pretty standard.

Now, for test purposes, I want to create a new pipeline to be able to push any feature branch to the test stack.

Every time I execute git push origin feature-1, or git push origin feature-2, ecc..., I want that feature branch to be deployed. In this way I can test the branch and then merge it to master to deploy it to prd. Is that possible?

It is OK if the branches to be deployed to test need to have a prefix. Of courde I would like not to trigger the first pipeline.

thanks M

asked a year ago1363 views
2 Answers
1
Accepted Answer

The way that CodePipeline works today each branch would need its own pipeline and each branch would trigger is respective pipeline. So if you push to your test branch codepipline on the main branch should not trigger until you merge changes to the main branch. If you pushed to test and it passed all your tests, you can have a step in codepipeline using codebuild or a lambda invoke step that merges the test branch into Main, which would then trigger that pipeline out to production. You can take a look at this blog post which provides another way to accomplish this and included sample code. You can also look at the preview of CodeCatalyst as well. Hope this make sense and is helpful.

profile pictureAWS
aaron_l
answered a year ago
  • You can blame me for this behavior :). I had identified an issue when BitBucket integration was in beta and I wanted to have separate Pipeline in my Development, Staging, and Production environments to match with my branches.

0

Follow this: https://docs.aws.amazon.com/codepipeline/latest/userguide/pipelines-trigger-source-repo-changes-console.html.

You will need to setup a cloud watch rule associated to code commit, which then can be customized with either lambda or other integrations.

profile picture
EXPERT
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions