Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Auf dieser Seite wird erläutert, wie Sie manuelle Trigger erstellen, um Code in Quell-Repositories zu erstellen. Manuelle Trigger können verwendet werden, um Builds manuell aufzurufen. Damit haben Sie die Möglichkeit, die definierten Substitutionsvariablen vor dem Ausführen eines Builds zu überschreiben. Sie können auch manuelle Trigger für die automatische Ausführung zu einem bestimmten Zeitpunkt planen.
Weitere Informationen zum manuellen Starten von Builds mit der gcloud CLI oder der Cloud Build API finden Sie unter Builds manuell starten.
Mit manuellen Triggern können Sie Builds einrichten, die nur ausgeführt werden, wenn Sie den Trigger in verbundenen Repositories aufrufen. Angenommen, Sie erstellen eine Pipeline zum Bereitstellen Ihres Quellcodes in einer Staging- oder Produktionsumgebung.
Sie können Ihren Workflow automatisieren, aber nur Builds manuell ausführen. Sie können manuelle Trigger dafür definieren.
Mit manuellen Triggern können Sie Builds manuell auslösen, indem Sie:
Quellcode aus einem gehosteten Repository mit einem angegebenen Zweig oder Tag abrufen.
Ihren Build mit Substitutionen parametrisieren, die nicht jedes Mal manuell eingegeben werden müssen, wenn Sie einen Build ausführen.
Definierte Substitutionsvariablewerte zum Zeitpunkt des Aufrufs vor der Ausführung eines Builds überschreiben.
Wenn Sie Builds aus Ihrem lokalen Arbeitsverzeichnis anstelle eines gehosteten Repositories ausführen oder Builds einreichen möchten, ohne einen Trigger zu erstellen, können Sie den folgenden gcloud-Befehl in Ihrem Arbeitsverzeichnis ausführen:
BUILD_CONFIG ist der Pfad zur Build-Konfigurationsdatei.
SOURCE_CODE ist der Pfad oder die URL zum Quellcode.
Weitere Informationen zur Verwendung des Befehls gcloud zum manuellen Starten von Builds in Ihrem lokalen Verzeichnis finden Sie unter Builds manuell starten.
Wählen Sie das Projekt oben auf der Seite aus und klicken Sie auf Öffnen.
Klicken Sie auf Trigger erstellen.
Geben Sie die folgenden Triggereinstellungen ein:
Name: Ein Name für Ihren Trigger
Region: Wählen Sie die Region für Ihren Trigger aus.
Wenn Sie global als Region auswählen, verwendet Cloud Build den Standardpool, um Ihren Build auszuführen.
Wenn Sie eine nicht globale Region auswählen und in der mit dem Trigger verknüpften Build-Konfigurationsdatei ein privater Pool angegeben ist, verwendet Cloud Build den privaten Pool, um Ihren Build auszuführen. In diesem Fall muss die Region, die Sie in Ihrem Trigger angeben, mit der Region übereinstimmen, in der Sie Ihren privaten Pool erstellt haben.
Wenn Sie eine nicht globale Region auswählen und in der mit dem Trigger verknüpften Build-Konfigurationsdatei kein privater Pool angegeben ist, verwendet Cloud Build den Standardpool, um den Build in derselben Region wie den Trigger auszuführen.
Beschreibung Optional: Eine Beschreibung für Ihren Trigger.
Ereignis: Wählen Sie Manueller Aufruf aus, um den Trigger so einzurichten, dass Builds nur ausgeführt werden, wenn der Trigger manuell aufgerufen wird.
Quelle: Wählen Sie das Repository aus, das bei Ausführung des manuellen Triggers erstellt werden soll. Sie können 1. Generation oder 2. Generation als Quelle angeben.
Revision: Wählen Sie den Branch oder das Tag aus, der erstellt werden soll, wenn der manuelle Trigger ausgeführt wird.
Branch: Legen Sie einen Trigger fest, der auf diesem Zweig erstellt werden soll.
Sie müssen einen Literalwert angeben. Reguläre Ausdrücke werden derzeit nicht unterstützt.
Tag: Legen Sie einen Trigger fest, der auf diesem Tag basiert. Sie müssen einen Literalwert angeben. Reguläre Ausdrücke werden derzeit nicht unterstützt.
Konfiguration: Wählen Sie die Build-Konfigurationsdatei aus, die sich in Ihrem Remote-Repository befindet, oder erstellen Sie eine Inline-Build-Konfigurationsdatei für den Build.
Typ: Wählen Sie den Konfigurationstyp aus, der für Ihren Build verwendet werden soll.
Cloud Build-Konfigurationsdatei (YAML oder JSON): Verwenden Sie eine Build-Konfigurationsdatei für Ihre Konfiguration.
Dockerfile: Verwenden Sie für Ihre Konfiguration eine Dockerfile.
Speicherort: Geben Sie den Speicherort für Ihre Konfiguration an.
Repository: Wenn sich Ihre Konfigurationsdatei in Ihrem Remote-Repository befindet, geben Sie den Speicherort Ihrer Build-Konfigurationsdatei, des Dockerfile-Verzeichnisses oder des Verzeichnisses der Buildpacks an. Wenn Ihr Build-Konfigurationstyp eine Dockerfile oder ein Buildpack ist, müssen Sie einen Namen für das resultierende Image und optional ein Zeitlimit für den Build angeben. Wenn Sie den Image-Namen der Dockerfile oder des Buildpacks angegeben haben, sehen Sie eine Vorschau des Befehls docker build oder pack, den Ihr Build ausführen wird.
Inline: Wenn Sie die Cloud Build-Konfigurationsdatei (YAML oder JSON) als Konfigurationsoption ausgewählt haben, können Sie die Build-Konfiguration inline angeben. Klicken Sie auf Editor öffnen, um Ihre Build-Konfigurationsdatei in der Google Cloud Konsole in der YAML- oder JSON-Syntax zu schreiben. Klicken Sie auf Fertig, um die Build-Konfiguration zu speichern.
Klicken Sie auf Erstellen, um den manuellen Trigger zu erstellen.
Nachdem Sie auf Trigger ausführen geklickt haben, wird rechts der Fensterbereich Trigger ausführen angezeigt. Wenn Sie Felder wie "Branch-Name", "Tag-Name" oder "Substitutionsvariablen" angegeben haben, können Sie diese Felder zum Zeitpunkt des Aufrufs überschreiben.
Wenn Sie neue Variablenwerte für die Substitution angegeben haben, klicken Sie auf Trigger ausführen, um den Build auszuführen.
Informationen zum manuellen Ausführen von Triggern nach Zeitplan finden Sie unter Builds planen.
gcloud
Führen Sie den folgenden Befehl aus, um einen manuellen Trigger mit dem gcloud-Befehlszeilentool auszuführen:
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-09-01 (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,["1st 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 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\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\nConsole\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\ngcloud\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\nConsole\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\ngcloud\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- 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)."]]