I would like to have the CI-CD pipeline deployed for the develop and master branch at all times. Pipeline for feature branches to be created manually developers as and when needed.
At this stage, it deletes the pipeline for the master branch and deploys it for the develop branch. How can we keep the pipeline for multiple branches at the same time?
I’m still trying to figure out how to do deployments. I’ve been pushing stacks to different org accounts.
you are braver than i for trying to do this with branches.
fwiw, i would expect the other stack assets to be removed. keep I’m mind that all cdk does is generate a template file and push cloud formation stacks.
It becomes incredibly complex to try and do something and is the reason I use GitHub actions, Bitbucket Pipelines etc. The code pipeline limitation of being able to look at one branch is a big limitation.
You need completely different code pipelines to look at each branch which doesn’t work well for modern branching strategies.
CDK is amazing, but not CDK Pipelines because of CodePipeline
I was able to do that by adding more objects with repo/branch information in the array with name “Backend” Thank you for your response. Other alternate was to create stack name dynamically based on the repo-branch name.
I was able to do that by adding more objects with repo/branch information in the array with name “Backend” Thank you for your response. Other alternate was to create stack name dynamically based on the repo-branch name.
Thanks much for your response. I was able to do that by adding more objects with repo/branch information in the array with the name “Backend” Thank you for your response. Another alternate was to create stack names dynamically based on the repo-branch name.
CodePipeline is an opinionated solution, and the opinion is that trunk-based development is better. Depending on what you’re working on this may work, but some projects aren’t naturally amenable to that. Websites with evolve forward paths is one that is.
Git flow, one strategy that works with multiple branches, is more in line with retail software delivery and long running branches when supporting custom customer configurations. It can be bashed into CodePipeline because anything can, but the question is should you? That might depend on the cost vs other solutions.
As far as modern, I’d say trunk based is more modern than gitflow, but more because it defines ideas from chaos committing and adds rules like short lived feature branches and CI and feature abstraction patterns.
My go to is GitHub Flow - trunk based development is fine but sometimes you want to deploy to different environments via feature branches and code pipeline doesn’t support that. Gitflow is fine and has its places and even then you might want a Dev branch that deploys to a dev environment.
I don’t know about the aws labs example, but I can guess it’s probably using CodePipeline with Codebuild - which would explain your issue.
If that’s the case: look into using Codebuild alone, without CodePipeline (as it was done before CodePipeline was introduced). You’ll see that it’s possible to have a Codebuild project target any branch you want (we also use it for PRs with a webhook).
Chance are high that you can ditch CodePipeline.
And for some bizarre reason, almost nobody remembers that a Codebuild Project does this out of the box as long as you don’t trigger it via CodePipeline - had to solve the same problem two years ago, but the internet is full of bad advice concerning multi-branch pipelines in AWS.
For others encountering this, there is an excellent Stack Overflow post on how to deploy multiple pipelines, one for each branch. This method is preferred to a single pipeline because you can independently deploy one and then the other.
It works beautifully, I highly recommend this approach for others who have this kind of need: