1
votes

I have created a cloudwatch event which triggers a codebuild project when there is a push in the master branch of a codecommit repo. I am trying to build the project when there is a push in the "develop" branch. I can specify the source branch for triggering the build. However, codebuild is always building from the master branch.

I am looking for a way to send the source branch to codebuild when initiated by a cloudwatch event trigger.

This is my cloudwatch event.

enter image description here

1
have you considered letting codepipeline set all this up for you? - Randall Hunt
I'm pretty sure that the answer is a yes, but the idea shouldn't be having one pipeline per CodeBuild project, I'm having the same issue - Carlos J García

1 Answers

3
votes

It's of course a very old thread, but I found it when googling the same question, so maybe someone will find it useful: To make CloudWatch trigger a build on the PR where you pushed, when specifying target chose “Input Transformer”. There in “input path” enter {"source-version":"$.detail.sourceReference"}. In “Input Template” textbox enter {"sourceVersion": <source-version>}. Worked for me.