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

已提問 1 年前檢視次數 1395 次
2 個答案
1
已接受的答案

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
已回答 1 年前
  • 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
專家
已回答 1 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南