이 페이지에서는 소스 저장소에서 코드를 빌드하기 위해 수동 트리거를 만드는 방법을 설명합니다. 수동 트리거를 사용하면 빌드를 실행하기 전에 호출 시 정의된 대체 변수 값을 재정의할 수 있는 기능을 통해 빌드를 수동으로 호출할 수 있습니다. 또한 수동 트리거가 특정 시간에 자동으로 실행되도록 예약할 수 있습니다.
gcloud CLI 또는 Cloud Build API를 사용하여 수동으로 빌드를 시작하는 방법은 수동으로 빌드 시작을 참조하세요.
수동 트리거를 사용하면 연결된 저장소에서 트리거를 호출할 때만 실행되는 빌드를 설정할 수 있습니다. 스테이징 또는 프로덕션 환경에 소스 코드를 배포하기 위한 파이프라인을 만든다고 가정해 보겠습니다.
워크플로를 자동화하려 할 수 있지만 수동으로만 빌드를 실행하려고 합니다. 이를 위해 수동 트리거를 정의할 수 있습니다.
수동 트리거를 사용하면 다음을 통해 빌드를 수동으로 호출할 수 있습니다.
지정된 분기 또는 태그가 있는 호스팅된 저장소에서 소스 코드를 가져옵니다.
빌드를 실행할 때마다 수동으로 전달할 필요가 없는 대체 변수로 빌드를 매개변수화합니다.
빌드를 호출하기 전에 호출 시 정의된 대체 변수 값을 재정의합니다.
호스팅된 저장소 대신 로컬에서 작업 중인 디렉터리에서 빌드를 실행하거나 트리거를 만들지 않고 빌드를 제출하려는 경우 작업 디렉터리에서 다음 gcloud 명령어를 실행하면 됩니다.
전역이 아닌 리전을 선택하고 트리거와 연결된 빌드 구성 파일에서 비공개 풀을 지정하면 Cloud Build가 비공개 풀을 사용하여 빌드를 실행합니다. 이 경우 트리거에 지정하는 리전은 비공개 풀을 만든 리전과 일치해야 합니다.
전역이 아닌 리전을 선택하고 트리거와 연결된 빌드 구성 파일에서 비공개 풀을 지정하지 않으면 Cloud Build가 기본 풀을 사용하여 트리거와 동일한 리전에서 빌드를 실행합니다.
설명(선택사항): 트리거에 대한 설명입니다.
이벤트: 수동 호출을 선택하여 트리거를 수동으로 호출할 때만 빌드가 실행하도록 설정합니다.
소스: 수동 트리거가 실행될 때 빌드할 저장소를 선택합니다. 1세대 또는 2세대를 소스로 지정할 수 있습니다.
버전: 수동 트리거가 실행될 때 빌드할 브랜치 또는 태그를 선택합니다.
분기: 이 분기에서 빌드할 트리거를 설정합니다.
리터럴 값을 지정해야 합니다. 정규 표현식은 현재 지원되지 않습니다.
태그: 이 태그에 빌드할 트리거를 설정합니다. 리터럴 값을 지정해야 합니다. 정규 표현식은 현재 지원되지 않습니다.
구성: 원격 저장소에 있는 빌드 구성 파일을 선택하거나 빌드에 사용할 인라인 빌드 구성 파일을 만듭니다.
유형: 빌드에 사용할 구성의 유형을 선택합니다.
Cloud Build 구성 파일(yaml 또는 json): 구성에 대해 빌드 구성 파일을 사용합니다.
Dockerfile: 해당 구성에 Dockerfile을 사용합니다.
위치: 구성의 위치를 지정합니다.
저장소: 구성 파일이 원격 저장소에 있으면 빌드 구성 파일의 위치, Dockerfile 디렉터리 또는 빌드팩 디렉터리를 제공합니다. 빌드 구성 유형이 Dockerfile 또는 빌드팩이면 결과 이미지의 이름을 제공하고, 선택적으로 빌드의 제한 시간을 제공해야 합니다. Dockerfile 또는 빌드팩 이미지 이름을 제공한 경우 빌드가 실행할 docker build 또는 pack 명령어의 미리보기가 표시됩니다.
인라인: Cloud Build 구성 파일(yaml 또는 json)을 구성 옵션으로 선택한 경우 빌드 구성을 인라인으로 지정할 수 있습니다. YAML 또는 JSON 구문을 사용하여 Google Cloud 콘솔에서 빌드 구성 파일을 작성하려면 편집기 열기를 클릭합니다. 빌드 구성을 저장하려면 완료를 클릭합니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-04(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)."]]