CmdID / aws / aws codebuild
aws codebuild update-webhook
Updates the webhook associated with an CodeBuild build project. AWS CLI reference
1 example 6 options Its page in the AWS CLI reference
Examples
To update the webhook for an AWS CodeBuild project
The following update-webhook example updates a webhook for the specified CodeBuild project with two filter groups. The --rotate-secret parameter specifies that GitHub rotate the project's secret key every time a code change triggers a build. The first filter group specifies pull requests that are created, updated, or reopened on branches with Git reference names that match the regular expression ^refs/heads/master$ and head references that match ^refs/heads/myBranch$. The second filter group specifies push requests on branches with Git reference names that do not match the regular expression ^refs/heads/myBranch$.
aws codebuild update-webhook --project-name Project2 --rotate-secret --filter-groups "[[{\"type\":\"EVENT\",\"pattern\":\"PULL_REQUEST_CREATED, PULL_REQUEST_UPDATED, PULL_REQUEST_REOPENED\"},{\"type\":\"HEAD_REF\",\"pattern\":\"^refs/heads/myBranch$\",\"excludeMatchedPattern\":true},{\"type\":\"BASE_REF\",\"pattern\":\"^refs/heads/master$\",\"excludeMatchedPattern\":true}],[{\"type\":\"EVENT\",\"pattern\":\"PUSH\"},{\"type\":\"HEAD_REF\",\"pattern\":\"^refs/heads/myBranch$\",\"excludeMatchedPattern\":true}]]"Identify--project-nameThe name of the CodeBuild project.--rotate-secretA boolean value that specifies whether the associated GitHub repository's secret token should be updated.--filter-groupsAn array of arrays of WebhookFilter objects used to determine if a webhook event can trigger a build.Its output, shortened
{
"webhook": {
"filterGroups": [
[
{
"pattern": "PULL_REQUEST_CREATED, PULL_REQUEST_UPDATED, PULL_REQUEST_REOPENED",
"type": "EVENT"
},
{
"excludeMatchedPattern": true,
"pattern": "refs/heads/myBranch$",
"type": "HEAD_REF"
},
{
"excludeMatchedPattern": true,
"pattern": "refs/heads/master$",
"type": "BASE_REF"
}
],
[
{
"pattern": "PUSH",
"type": "EVENT"
},
{
"excludeMatchedPattern": true,
"pattern": "refs/heads/myBranch$",
"type": "HEAD_REF"
}
]
… 4 more linesFor more information, see Change build project settings in AWS CodeBuild in the AWS CodeBuild User Guide.
Options
--branch-filterA regular expression used to determine which repository branches are built when a webhook is triggered.--build-typeSpecifies the type of build this webhook will trigger.--filter-groupsAn array of arrays of WebhookFilter objects used to determine if a webhook event can trigger a build.--project-nameThe name of the CodeBuild project.--pull-request-build-policyA PullRequestBuildPolicy object that defines comment-based approval requirements for triggering builds on pull requests.--rotate-secretA boolean value that specifies whether the associated GitHub repository's secret token should be updated.