Reputation: 47
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.
Upvotes: 2
Views: 891
Reputation: 51
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.
Upvotes: 4