Cloud Build triggers

Cloud Build uses build triggers to enable CI/CD automation. You canconfigure triggers to listen for incoming events, such as when a new commit ispushed to a repository or when a pull request is initiated, and thenautomatically execute a build when new events come in. You can also configuretriggers to build code on any changes to your source repository or only onchanges that match certain criteria.

This page provides an overview of each trigger type and capabilities associatedwith triggers.

Repository event triggers

Cloud Build lets you to automatically execute builds on repositoryevents such as pushes or pull requests. You can connect external repositories,such as repositories in GitHub or Bitbucket, to Cloud Build or usecode in Cloud Source Repositoriesfor your builds. While you can connect any source repository toCloud Build, Cloud Build provides specific repositoryevent triggers you can can use to integrate specific source code managementsystems (SCMs). This section discusses available repository event triggers.

Caution: Effective June 17, 2024, Cloud Source Repositories isn't available to new customers. If your organization hasn't previously used Cloud Source Repositories, you can't enable the API or use Cloud Source Repositories. New projects not connected to an organization can't enable the Cloud Source Repositories API. Organizations that have used Cloud Source Repositories prior to June 17, 2024 are not affected by this change.

GitHub triggers

You can create GitHub triggers to automatically execute builds in response torepository events, such as pushes or pull requests. You can view the trigger'sbuild status on GitHub and Google Cloud console. You can also use theCloud Build GitHub appto connect and build code in GitHub. To learn more, seeBuilding repositories from GitHub.

GitHub Enterprise triggers

You can create triggers for repositories hosted on a GitHub Enterprise instance,including instances hosted in an on-premises environment and not reachable overa public internet connection. GitHub Enterprise triggers can be used to executebuilds in response to pushes or pull requests from a GitHub Enterprise instance.To learn more, seeBuilding repositories from GitHub Enterprise.

GitLab Enterprise Edition triggers

You can create triggers for repositories hosted on a GitLab Enterprise Editioninstance, including instances hosted in a private network. GitLab EnterpriseEdition triggers can be used to execute builds in response to commit pushes orpull requests associated with your GitLab Enterprise Edition repository. Tolearn more, seeBuilding repositories from GitLab Enterprise Edition.

Bitbucket Server triggers

You can create triggers for repositories hosted on a Bitbucket Server instance,including instances hosted in an on-premises environment. You can connect yourBitbucket Server repository to Cloud Buildmultiple times with multiple host connections. To learn more on how to createtriggers to execute builds in response to events, seeBuilding repositories from Bitbucket Server.

Bitbucket Data Center triggers

You can create triggers for repositories hosted on a Bitbucket Data Centerinstance, including instances hosted in an on-premises environment. BitbucketData Center triggers can be used to execute builds in response to events such ascommit pushes or pull requests. To learn more, seeBuilding repositories from Bitbucket Data Center.

Bitbucket Cloud triggers

You can create triggers for repositories hosted in Bitbucket Cloud. BitbucketCloud triggers can be used to execute builds in response to events such ascommit pushes or pull requests. To learn more, seeBuilding repositories from Bitbucket Cloud.

Manual triggers

You can create manual triggers to execute builds manually and override definedsubstitution variable values at invocation time prior to executing a build. Youcan also configure manual triggers torun on a schedule.To learn more, seeManually build code in source repositories.

Pub/Sub triggers

Note: Cloud Build Pub/Sub triggers are not supportedwhen VPC Service Controls is used.

You can create Pub/Sub triggers to execute builds in response toany message published over Pub/Sub. For example, you can usePub/Sub triggers for building in response to image pushes toArtifact Registry. In this case, you can configure your trigger to use filters toexecute a build only if the pushed image matches a specific tag, such asprod.Additionally, Pub/Sub triggers can be configured to subscribe toany Pub/Sub topic. To learn more, seeAutomate builds in response to Pub/Sub events.

Webhook triggers

You can create webhook triggers to execute builds in response to webhooks.Webhook events sent to a custom URL enable you to directly connect externalsystems and external source code management systems (SCMs), such asBitbucket.com, Bitbucket Server, or GitLab, to Cloud Build. Whencreating webhook triggers, you can also define your build configuration inlineon your trigger to control which repositories your trigger clones during buildtime rather than explicitly specifying a source. To learn more, seeAutomate builds in response to webhook events.Additionally, to learn to use webhook triggers to build repositories fromspecific SCMs, seeBuilding repositories from Bitbucket Server,Building repositories from Bitbucket Cloud, andBuilding repositories from GitLab.

Triggers for Developer Connect-linked repositories

Developer Connect lets youconnect external products or non-Google developer tools to Google Cloud usingstandardized steps and apps. You can configure triggers that buildfrom repositories connected through Developer Connect forthe following SCMs:

Trigger capabilities

Cloud Build triggers provide capabilities that give you fine-grainedcontrol over how a build is executed. This section discusses variouscapabilities associated with triggers.

Scheduled manual triggers

You can schedule manual triggers to automatically execute builds on apredefined schedule. For example, you may want to configure a scheduled triggerto run a build every Saturday at 6:00 AM. To schedule builds, you cancreate a manual triggerand invoke the trigger using Cloud Scheduler. To learn more, seeSchedule builds.

Filtering events

Cloud Build usesCommon Expression Language (CEL) with thevariable,build, on fields listed in theBuild resource to accessfields associated with your build event such as your trigger ID, image list, orsubstitution values. You can use thefilter string to filter build events inyour build config file using any field listed in theBuild resource. To learnmore, seeUse CEL to filter build events

Substitution variables

You can specify substitution variables in your build configuration file tosubstitute specific values at build time. For example, you may want touse substitution variables if a value is not known until build time or ifyou want to re-use an existing build request with different variables.Cloud Build provides default substitutions you can use forbuilds invoked by triggers, such as variables mapping to your triggername or repository name. You can also define your own substitution variables.To learn more, seeSubstituting variable values.

Bash parameter expansions

You can apply bash parameter expansions to substitution variable values. Bashparameter expansions allow you to manipulate strings associated withexisting variables. For example, you can use bash parameter expansionsto capitalize letters or replace a substring. To learn more, seeBash parameter expansions.

Payload bindings

You can store part of your trigger's event payload as a substitutionvariable by using payload bindings. Variables associated with a payload arereferred to as bindings and are available for builds invokedby both push and pull events. You can use bindings to access additional datarelated to your build, such as the author of a pull request. To learn more,seePayload bindings.

Approvals

You can configure triggers to not immediately execute a build, but instead marka build as pending until approved. If a user with permissions approves a pendingbuild, the build starts. If the approval is denied, the build doesn't start. Tolearn how to configure triggers that requireapproval, seeGate builds on approval.

Build status notifications

You can configure Cloud Build notifiers to listen to build eventupdates from Pub/Subon the defaultcloud-builds topic or a user-defined topic.Notifiers canalso filter messages received by the topic and send messages to your connectedservices. Cloud Build provides and maintains deployable notifierimages in thecloud-build-notifiers repository.You can configure notifications using a Cloud Build notifier,such asBigQuery,HTTP,Slack, orSMTP orcreate your own notifier.

What's next

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-02-19 UTC.