Configure a code source trigger
You can filter webhook events from your code source by configuring triggering events and trigger branches.
Feature description
By default, the code source trigger in Cloud Build supports the following code repositories and triggering events.
GitHub | Gitee | GitLab | Apsara DevOps Codeup | Bitbucket | Coding | Generic Git | |
push | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
A push event occurs when you push a local branch to a remote branch or modify a file in the web interface of your code management platform. For example, pushing the local master branch to origin/master. Cloud Build compares the target branch of the push with the configured trigger branch. If they match, the pipeline is triggered. The pipeline run then uses the target branch from the push event.
Instructions
Open the pipeline editing page. For more information, see Open the pipeline editing page.
On the pipeline editor page, in the Trigger stage, click the
icon next to Code Source Trigger to open the Code Source Trigger Configuration sidebar.In the Code Source Trigger Configuration pane, turn on the Enable switch. This enables the code source trigger and generates a webhook URL.
Enter the URL and branch of the repository to monitor.
NoteYou can enter the repository URL manually. The URL can be different from the repository configured for the current build pipeline.
For the repository branch, you can use a Glob wildcard expression to match multiple branches. For more information, see Matching rules for trigger branches.
Click Add repository to monitor to add another repository URL and branch.
NoteClick the
icon to delete a monitored repository.Click OK to save the source code trigger configuration.
To copy the Cloud Build webhook URL, click Click to copy. Then, configure the webhook in the repository that you want to monitor. For more information, see Configure a repository webhook.

Matching rules for trigger branches
The trigger branch field supports Glob wildcard expressions. The following table shows common examples.
Example | Description |
| Specify the branch. |
| All branches that start with |
| The ? character represents any single character. |
For more information, see the Glob wildcard documentation.