Stay organized with collections
Save and categorize content based on your preferences.
This page explains how to create manual triggers to build code
in source repositories. Manual triggers can be used
to invoke builds manually, with the ability to override defined substitution variable values at
invocation time prior to running a build. You can also schedule manual
triggers to automatically run at a specific time.
To learn how to start builds manually using the gcloud CLI or
the Cloud Build API, see
Starting builds manually.
Manual triggers enable you to set up builds that are only executed
when you invoke your trigger on connected repositories. Let's say you're creating
a pipeline for deploying your source code to a staging or production environment.
You might want to automate your workflow, but are only looking to execute builds
manually. You can define manual triggers to do so.
Manual triggers enable you to manually invoke builds by:
Fetching source code from a hosted repository with a specified branch or tag.
Parametizing your build with substitutions that don't need to be passed in
manually each time you execute a build.
Overriding defined substitution variable values at invocation time prior to
invoking a build.
If you want to execute builds from your local working directory instead of a hosted repository
or want to submit builds without creating a trigger, you can run the following
gcloud command in your working directory:
If you select global as the region,
Cloud Build uses the default
pool to run your build.
If you select a non-global region and the
build config file associated with the trigger
specifies a private pool, Cloud Build uses the private
pool to run your build. In this case, the region you specify in your trigger must match the region where you created your private pool.
If you select a non-global region and the
build config file associated with the trigger
does not specify a private pool,
Cloud Build uses the default
pool to run your build in the same region
as your trigger.
Description (Optional): A description for your trigger.
Event: Select Manual invocation to set up your trigger so that builds
only run when the trigger is manually invoked.
Source: Select the repository to build when the manual trigger runs. You can
specify 1st generation or 2nd generation as your source.
Revision: Select the branch or tag to build when the manual trigger
runs.
Branch: Set a trigger to build on this branch.
You must specify a literal value. Regular expressions are not currently
supported.
Tag: Set a trigger to build on this tag. You must specify a literal
value. Regular expressions are not currently supported.
Configuration: Select the build config file located in
your remote repository or create an inline build config file to
use for your build.
Type: Select the type of configuration to use for your build.
Cloud Build configuration file (yaml or json):
Use a build config file for your configuration.
Dockerfile: Use a Dockerfile for your configuration.
Location: Specify the location for your configuration.
Repository: If your config file is located in your
remote repository, provide the location of your
build config file, the Dockerfile
directory, or the buildpacks directory. If your build config
type is a Dockerfile or a buildpack, you will need to provide
a name for the resulting image and optionally, a timeout for your
build. When you've provided the Dockerfile or buildpack
image name, you'll see a preview of the docker build or
pack command that your build will execute.
Inline: If you selected
Cloud Build configuration file (yaml or json) as your configuration option, you can specify your build config inline. Click Open Editor to write your build config file in the Google Cloud console using YAML or JSON syntax. Click Done to save your build config.
After clicking Run trigger, you will see the Run trigger window pane
on the right side. If you specified fields such as a branch name, tag
name, or substitution variables, you will be able to override these fields
at invocation time.
If you specified new variable values for your substitution, click Run trigger
to execute your build.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eManual triggers allow for the execution of builds on connected repositories only when the trigger is invoked, providing control over build timing.\u003c/p\u003e\n"],["\u003cp\u003eBuilds can be parameterized with substitution variables, which can be overridden at invocation time without requiring manual input each time.\u003c/p\u003e\n"],["\u003cp\u003eManual triggers can be created via the Google Cloud console or the \u003ccode\u003egcloud\u003c/code\u003e command-line tool, with options to specify source repository, branch, tag, and build configuration.\u003c/p\u003e\n"],["\u003cp\u003eRunning a manual trigger can be done through the console or the \u003ccode\u003egcloud\u003c/code\u003e command, and allows for overriding specified fields like branch names, tag names, or substitution variables.\u003c/p\u003e\n"],["\u003cp\u003eYou have the option to schedule manual triggers to run at a specific time, in addition to invoking them manually.\u003c/p\u003e\n"]]],[],null,["# Manually build code in source repositories\n\n1st gen 2nd gen\n\nThis page explains how to create manual triggers to build code\nin source repositories. Manual triggers can be used\nto invoke builds manually, with the ability to override defined substitution variable values at\ninvocation time prior to running a build. You can also schedule manual\ntriggers to automatically run at a specific time.\n\nTo learn how to start builds manually using the gcloud CLI or\nthe Cloud Build API, see\n[Starting builds manually](/build/docs/running-builds/start-build-manually).\n\nBefore you begin\n----------------\n\n-\n\n\n Enable the Cloud Build API.\n\n\n [Enable the API](https://console.cloud.google.com/flows/enableapi?apiid=cloudbuild.googleapis.com&redirect=https://cloud.google.com/build/docs/automating-builds/create-manual-triggers)\n\n\u003c!-- --\u003e\n\n- Have your source code ready.\n\nManual triggers\n---------------\n\nManual triggers enable you to set up builds that are only executed\nwhen you invoke your trigger on connected repositories. Let's say you're creating\na pipeline for deploying your source code to a staging or production environment.\nYou might want to automate your workflow, but are only looking to execute builds\nmanually. You can define manual triggers to do so.\n\nManual triggers enable you to manually invoke builds by:\n\n- Fetching source code from a hosted repository with a specified branch or tag.\n- Parametizing your build with substitutions that don't need to be passed in manually each time you execute a build.\n- Overriding defined substitution variable values at invocation time prior to invoking a build.\n\nIf you want to execute builds from your local working directory instead of a hosted repository\nor want to submit builds without creating a trigger, you can run the following\n`gcloud` command in your working directory: \n\n gcloud builds submit --config \u003cvar translate=\"no\"\u003eBUILD_CONFIG\u003c/var\u003e \u003cvar translate=\"no\"\u003eSOURCE_CODE\u003c/var\u003e\n\nWhere:\n\n- \u003cvar translate=\"no\"\u003eBUILD_CONFIG\u003c/var\u003e is the path to the build config file.\n- \u003cvar translate=\"no\"\u003eSOURCE_CODE\u003c/var\u003e is the path or URL source code.\n\nTo learn more about how to use the `gcloud` command to start builds manually\nin your local directory, see [Starting builds manually](/build/docs/running-builds/start-build-manually).\n\nCreating manual triggers\n------------------------\n\n### Console\n\nTo create a manual trigger:\n\n1. Open the **Triggers** page:\n\n [Open the Triggers page](https://console.cloud.google.com/cloud-build/triggers)\n2. Select your project from the top of the page and click **Open**.\n\n3. Click **Create trigger**.\n\n4. Enter the following trigger settings:\n\n - **Name**: A name for your trigger.\n - **Region** : Select the [region](/build/docs/locations) for your trigger.\n\n - If you select **global** as the region, Cloud Build uses the default pool to run your build.\n - If you select a non-global region and the build config file associated with the trigger specifies a [private pool](/build/docs/private-pools/private-pools-overview), Cloud Build uses the private pool to run your build. In this case, the region you specify in your trigger must match the region where you created your private pool.\n - If you select a non-global region and the build config file associated with the trigger does **not** specify a private pool, Cloud Build uses the default pool to run your build in the same region as your trigger.\n - **Description** (Optional): A description for your trigger.\n\n - **Event** : Select **Manual invocation** to set up your trigger so that builds\n only run when the trigger is manually invoked.\n\n - **Source** : Select the repository to build when the manual trigger runs. You can\n specify **1st generation** or **2nd generation** as your source.\n\n | **Note:** The region of your repository must match the region of your trigger. If your source is in Cloud Source Repositories, your repository is not connected to a particular region, but to your project.\n | **Caution:** Effective June 17, 2024, Cloud Source Repositories isn't available\n | to new customers. If your organization hasn't\n | previously used Cloud Source Repositories, you can't enable the API or use\n | Cloud Source Repositories. New projects not connected to an organization can't enable the\n | Cloud Source Repositories API. Organizations that have used Cloud Source Repositories prior to\n | June 17, 2024 are not affected by this change.\n - **Revision**: Select the branch or tag to build when the manual trigger\n runs.\n\n - **Branch**: Set a trigger to build on this branch.\n You must specify a literal value. Regular expressions are not currently\n supported.\n\n - **Tag**: Set a trigger to build on this tag. You must specify a literal\n value. Regular expressions are not currently supported.\n\n - **Configuration**: Select the build config file located in\n your remote repository or create an inline build config file to\n use for your build.\n\n - **Type** : Select the type of configuration to use for your build.\n - **Cloud Build configuration file (yaml or json)**: Use a build config file for your configuration.\n - **Dockerfile** : Use a `Dockerfile` for your configuration.\n - **Location**: Specify the location for your configuration.\n\n - **Repository** : If your config file is located in your remote repository, provide the location of your [build config file](/build/docs/build-config), the `Dockerfile` directory, or the buildpacks directory. If your build config type is a `Dockerfile` or a buildpack, you will need to provide a name for the resulting image and optionally, a timeout for your build. When you've provided the `Dockerfile` or buildpack image name, you'll see a preview of the `docker build` or `pack` command that your build will execute.\n - **Inline** : If you selected **Cloud Build configuration file (yaml or json)** as your configuration option, you can specify your build config inline. Click **Open Editor** to write your build config file in the Google Cloud console using YAML or JSON syntax. Click **Done** to save your build config.\n\n | **Note:** Inline build configuration support is not available for `Dockerfile`.\n5. Click **Create** to create your manual trigger.\n\n### gcloud\n\nFor a complete list of flags, see the [`gcloud` reference for how to create manual triggers](/../sdk/gcloud/reference/alpha/builds/triggers/create/manual).\n\nRunning manual triggers\n-----------------------\n\n### Console\n\nTo run a manual trigger using Google Cloud console:\n\n1. Open the **Triggers** page in the Google Cloud console.\n\n [Open the triggers page](https://console.cloud.google.com/cloud-build/triggers)\n2. Locate your trigger in the list.\n\n3. Click **Run trigger**.\n\n After clicking **Run trigger** , you will see the **Run trigger** window pane\n on the right side. If you specified fields such as a branch name, tag\n name, or substitution variables, you will be able to override these fields\n at invocation time.\n | **Note:** You cannot specify any new fields or variables in this window pane. To do so, see instructions in the `gcloud` tab in this section.\n\n If you specified new variable values for your substitution, click **Run trigger**\n to execute your build.\n\n To run manual triggers on schedule, see\n [Scheduling builds](/build/docs/schedule-builds).\n\n### gcloud\n\nTo run a manual trigger using the `gcloud` command-line tool, run the following\ncommand: \n\n gcloud builds triggers run \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eTRIGGER_NAME\u003c/span\u003e\u003c/var\u003e \\\n --region=\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eREGION\u003c/span\u003e\u003c/var\u003e \\\n --branch=\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eBRANCH_NAME\u003c/span\u003e\u003c/var\u003e \\\n --substitutions=\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eSUBSTITUTION_VAR\u003c/span\u003e\u003c/var\u003e=\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eSUBSTITUTION_VALUE\u003c/span\u003e\u003c/var\u003e\n\nWhere:\n\n- \u003cvar translate=\"no\"\u003eTRIGGER_NAME\u003c/var\u003e is the name of your trigger.\n- \u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e is the [region](/build/docs/locations) for your trigger.\n- \u003cvar translate=\"no\"\u003eBRANCH_NAME\u003c/var\u003e is the name of your branch. You can also specify a tag using `--tag` or a commit ID using `--sha`.\n- \\[Optional\\]\u003cvar translate=\"no\"\u003eSUBSTITUTION_VAR\u003c/var\u003e is the variable name for your substitution value.\n- \\[Optional\\] \u003cvar translate=\"no\"\u003eSUBSTITUTION_VALUE\u003c/var\u003e is the value associated with your substitution variable.\n\nTo run manual triggers on schedule, see [Scheduling builds](/build/docs/schedule-builds).\n\nNext steps\n----------\n\n- Learn how to [start builds manually](/build/docs/running-builds/start-build-manually) using `gcloud` commands or the Cloud Build API.\n- Learn how to [schedule builds](/build/docs/automating-builds/schedule-builds).\n- Learn how to [create and manage triggers](/build/docs/automating-builds/create-manage-triggers).\n- Learn how to [view build results](/build/docs/view-build-results).\n- Learn how to [troubleshoot build errors](/build/docs/troubleshooting)."]]