Configure a code source trigger

Updated at:

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

Note

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

  1. Open the pipeline editing page. For more information, see Open the pipeline editing page.

  2. On the pipeline editor page, in the Trigger stage, click the Edit icon next to Code Source Trigger to open the Code Source Trigger Configuration sidebar.

  3. In the Code Source Trigger Configuration pane, turn on the Enable switch. This enables the code source trigger and generates a webhook URL.

  4. Enter the URL and branch of the repository to monitor.

    Note

    • You 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.

  5. Click Add repository to monitor to add another repository URL and branch.

    Note

    Click the Delete icon to delete a monitored repository.

  6. Click OK to save the source code trigger configuration.

  7. 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.Code source configuration

Matching rules for trigger branches

The trigger branch field supports Glob wildcard expressions. The following table shows common examples.

Example

Description

master

Specify the branch.

ma**

All branches that start with ma.

mas?er

The ? character represents any single character.

For more information, see the Glob wildcard documentation.