If using a Github repository as a source in a CodeBuild project, the Branch Filter
option allows to run builds only for branches, whose name is matching a certain regular expression.
- AWS Management Console
In the AWS Management Console you can configure the branch filter upon creating or editing a CodeBuild project:
- AWS CLI
For awscli exists an option --update-webhook
(documented here)
$ aws codebuild update-webhook --project-name myproject --branch-filter ^master$
- CloudFormation
In CodeBuild cloudformation template exists an option Triggers > Webhook
(documented here), but this option is just a boolean for simple enabling/disabling the github webhook.
Resources:
MyCodeBuildProject:
Type: AWS::CodeBuild::Project
Properties:
Name: myproject
...
Triggers:
Webhook: true
So my question is, how to directly define a branch filter in a cloudformation template, without subsequently having to execute an awscli command or use the AWS Management Console?