Can AWS CodePipeline track multiple feature branches and run tests on each?

CodePipeline is not the right tool for you. Create a separate, standalone CodeBuild project. It will work very much like other 3rd party CI services such as Travis.

There are a number of ways you can connect this "CI stage" to a continuous delivery pipeline, which is what CodePipeline is for:

  1. The simplest is just to use CodeBuild as a gate for pushing changes to the pipeline source branch, typically master.
  2. You can also push artifacts created in CodeBuild to ECR or S3 and trigger a pipeline from those events.
  3. If you want to get fancy, use some other jiggery pokery eg. Events, SQS and Lambda.

I had the same confusion as CodeBuild and CodePipeline are tightly interlinked but also separate tools. CodePipeline does use CodeBuild but each has its own Git connector that works differently.


I was looking for a solution to exactly this problem. Eventually I settled on having a CodeBuild, which can be triggered off of a branch regex, begin the pipeline by pushing an archive to a specific S3 key. In my case, I also had that CodeBuild do my full build/test process, but you could also configure the CodeBuild to only pull the code and push it the the S3 key that triggers your CodePipeline.

Here's part of an example CodeBuild config matching 2 branches: Example showing a <code>Branch filter</code> matching 2 branches

Then I set the CodeBuild artifact to go to a single key in a single bucket.

Then I setup a CodePipeline with an Amazon S3 source pointing to the same key/bucket.