create_webhook
¶
create_webhook(
project_name: ProjectName,
*,
config_overrides: Optional[CodeBuildClientConfig] = None,
branch_filter: Optional[String] = None,
filter_groups: Optional[FilterGroups] = None,
build_type: Optional[WebhookBuildType] = None,
manual_creation: Optional[WrapperBoolean] = None,
scope_configuration: Optional[ScopeConfiguration] = None,
pull_request_build_policy: Optional[PullRequestBuildPolicy] = None,
) -> CreateWebhookOutput
For an existing CodeBuild build project that has its source code stored in a GitHub or Bitbucket repository, enables CodeBuild to start rebuilding the source code every time a code change is pushed to the repository.
If you enable webhooks for an CodeBuild project, and the project is used as a build step in CodePipeline, then two identical builds are created for each commit. One build is triggered through webhooks, and one through CodePipeline. Because billing is on a per-build basis, you are billed for both builds. Therefore, if you are using CodePipeline, we recommend that you disable webhooks in CodeBuild. In the CodeBuild console, clear the Webhook box. For more information, see step 5 in Change a Build Project's Settings.
Parameters:
-
project_name(ProjectName) –The name of the CodeBuild project.
-
branch_filter(Optional[String], default:None) –A regular expression used to determine which repository branches are built when a webhook is triggered. If the name of a branch matches the regular expression, then it is built. If
branchFilteris empty, then all branches are built.It is recommended that you use
filterGroupsinstead ofbranchFilter. -
filter_groups(Optional[FilterGroups], default:None) –An array of arrays of
WebhookFilterobjects used to determine which webhooks are triggered. At least oneWebhookFilterin the array must specifyEVENTas itstype.For a build to be triggered, at least one filter group in the
filterGroupsarray must pass. For a filter group to pass, each of its filters must pass. -
build_type(Optional[WebhookBuildType], default:None) –Specifies the type of build this webhook will trigger.
RUNNER_BUILDKITE_BUILDis only available forNO_SOURCEsource type projects configured for Buildkite runner builds. For more information about CodeBuild-hosted Buildkite runner builds, see Tutorial: Configure a CodeBuild-hosted Buildkite runner in the CodeBuild user guide. -
manual_creation(Optional[WrapperBoolean], default:None) –If manualCreation is true, CodeBuild doesn't create a webhook in GitHub and instead returns
payloadUrlandsecretvalues for the webhook. ThepayloadUrlandsecretvalues in the output can be used to manually create a webhook within GitHub.manualCreationis only available for GitHub webhooks. -
scope_configuration(Optional[ScopeConfiguration], default:None) –The scope configuration for global or organization webhooks.
Global or organization webhooks are only available for GitHub and Github Enterprise webhooks.
-
pull_request_build_policy(Optional[PullRequestBuildPolicy], default:None) –A PullRequestBuildPolicy object that defines comment-based approval requirements for triggering builds on pull requests. This policy helps control when automated builds are executed based on contributor permissions and approval workflows.
Raises:
-
InvalidInputException–The input value that was provided is not valid.
-
OAuthProviderException–There was a problem with the underlying OAuth provider.
-
ResourceAlreadyExistsException–The specified Amazon Web Services resource cannot be created, because an Amazon Web Services resource with the same settings already exists.
-
ResourceNotFoundException–The specified Amazon Web Services resource cannot be found.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_codebuild/_services/code_build.py
1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 | |