2

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

2
  • have you considered letting codepipeline set all this up for you? Commented Nov 25, 2018 at 2:16
  • 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 Commented Jun 4, 2019 at 17:18

1 Answer 1

4

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.