Secure Source Manager 웹 인터페이스에서 웹훅을 만들 저장소로 이동합니다.
설정을 클릭합니다.
웹훅을 클릭한 다음 웹훅 추가를 클릭합니다.
Hook ID 필드에 웹훅의 ID를 입력합니다.
타겟 URL 필드에 웹훅 URL을 입력합니다. 예를 들어 Jenkins에서 빌드를 트리거하려면 웹훅 트리거를 설정한 다음 여기에 Jenkins 트리거 URL을 입력하여 Jenkins에서 빌드를 트리거하면 됩니다.
웹훅 트리거를 만들 때 입력한 키와 보안 비밀 값이 웹훅 URL에 포함되어 있는 경우 타겟 URL의 끝에서 이를 삭제하고 민감한 쿼리 문자열 필드에 복사합니다.
웹훅 URL에서 키와 비밀번호를 찾으려면 key=로 시작하는 텍스트를 찾으세요.
예를 들어 다음 URL이 있다고 가정해 보겠습니다.
https://cloudbuild.googleapis.com/v1/projects/my-project/triggers/test-trigger:webhook?key=eitIfKhYnv0LrkdsyHqIros8fbsheKRIslfsdngf&secret=Hello%20Secret%20Manager
타겟 URL 필드에서 물음표 ?key=...로 시작하는 부분을 복사하여 삭제합니다. 그런 다음 초기 물음표를 삭제하고 나머지 부분 key=...을 민감한 쿼리 문자열 필드로 이동합니다.
트리거 조건 섹션에서 다음 중 하나를 선택합니다.
푸시: 저장소로 푸시할 때 트리거됩니다.
Pull request state changed: pull request 상태가 변경될 때 트리거됩니다.
푸시를 선택한 경우 브랜치 필터 필드에 푸시 이벤트 허용 목록을 입력할 수 있습니다.
브랜치 필터 필드는 glob 패턴을 사용하며 일치하는 브랜치에 대한 작업만 빌드 트리거를 발생시킵니다. 필드가 비어 있거나 *이면 모든 브랜치의 푸시 이벤트가 보고됩니다. 구문에 대한 자세한 내용은 glob 문서를 참고하세요.
웹훅 추가를 클릭합니다.
웹훅이 웹훅 페이지에 표시됩니다.
웹훅 테스트
Secure Source Manager 웹훅 페이지에서 테스트할 웹훅을 클릭합니다.
페이지 하단으로 이동하여 전송 테스트를 클릭합니다.
자리표시자 이벤트가 전송 대기열에 추가됩니다. 전송 기록에 표시되기까지 몇 초 정도 걸릴 수 있습니다.
git 명령어를 사용하여 풀 요청을 푸시하거나 병합하여 웹훅을 테스트할 수도 있습니다.
웹훅 트리거를 구성한 서비스의 빌드 기록에서 트리거된 빌드 또는 이벤트의 상태를 확인합니다.
첫 번째 테스트 전송을 보낸 후 Secure Source Manager 웹훅 페이지의 최근 전송 섹션에서 테스트 전송의 요청 및 응답을 확인할 수도 있습니다.
Cloud Build YAML 변수를 페이로드 데이터로 대체
웹훅을 사용하여 Cloud Build에 연결하는 경우 Cloud Build YAML 변수를 Secure Source Manager 웹훅 페이로드 데이터로 대체할 수 있습니다.
Secure Source Manager 웹훅 페이지의 최근 전송 섹션에서 상단 행을 클릭합니다.
웹훅 페이로드에서 전송된 Request 헤더와 콘텐츠가 표시됩니다.
Cloud Build 대시보드로 이동한 다음 트리거를 클릭합니다.
구성하려는 트리거를 클릭합니다.
고급 섹션의 대체 변수에서 + 변수 추가를 클릭합니다.
변수의 이름과 값을 입력합니다. 값 접두사는 body입니다.
예를 들어 _REPO_URL을 페이로드 데이터 필드 repository.clone_url로 대체하고 _COMMIT_SHA을 Cloud Build YAML의 최신 커밋 sha로 대체하려면 다음 이름과 값을 입력합니다.
[[["이해하기 쉬움","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)"],[],[],null,["# Set up webhooks\n\nThis page describes how to set up webhooks in Secure Source Manager.\n\nWebhooks are HTTP requests triggered by an event in Secure Source Manager, and\nsent to a user-specified URL.\n\nBefore you begin\n----------------\n\n1. [Create a Secure Source Manager instance](/secure-source-manager/docs/create-instance).\n2. [Create a Secure Source Manager repository](/secure-source-manager/docs/create-repository).\n\n### Required roles\n\n\nTo get the permissions that\nyou need to create webhooks,\n\nask your administrator to grant you the\nfollowing IAM roles:\n\n- [Secure Source Manager Repository Admin](/iam/docs/roles-permissions/securesourcemanager#securesourcemanager.repoAdmin) (`roles/securesourcemanager.repoAdmin`) on the Secure Source Manager repository\n- [Secure Source Manager Instance Accessor](/iam/docs/roles-permissions/securesourcemanager#securesourcemanager.instanceAccessor) (`roles/securesourcemanager.instanceAccessor`) on the Secure Source Manager instance\n\n\nFor more information about granting roles, see [Manage access to projects, folders, and organizations](/iam/docs/granting-changing-revoking-access).\n\n\nYou might also be able to get\nthe required permissions through [custom\nroles](/iam/docs/creating-custom-roles) or other [predefined\nroles](/iam/docs/roles-overview#predefined).\n\nFor information on granting Secure Source Manager roles,\nsee [Access control with IAM](/secure-source-manager/docs/access-control) and\n[Grant users instance access](/secure-source-manager/docs/grant-users-instance-access).\n\nSet up a webhook\n----------------\n\n1. In the Secure Source Manager web interface, navigate to the repository you want to create a webhook for.\n2. Click **Settings**.\n3. Click **Webhooks** , and then click **Add webhook**.\n4. In the **Hook ID** field, enter an ID for the webhook.\n\n | **Note:** Hook IDs must follow the [resource naming convention](https://google.aip.dev/122#resource-id-segments). They must include only lower case letters, numbers, or dashes, must begin with a letter, and cannot be changed after creating the webhook.\n5. In the **Target URL** field, enter the Webhook URL. For example, if you want\n to trigger a build in Jenkins, you could\n [Set up a webhook trigger](/secure-source-manager/docs/connect-jenkins#set_up_a_webhook_trigger), and then enter\n the Jenkins trigger URL here to trigger your build in Jenkins.\n\n6. If the Webhook URL contains your key and secret values entered when you\n created your webhook trigger, remove them from the end of the target URL\n and copy them to the **Sensitive Query String** field.\n\n To locate your key and secret in your webhook URL, look for the text\n starting with `key=`\n\n For example, given the following URL:\n `https://cloudbuild.googleapis.com/v1/projects/my-project/triggers/test-trigger:webhook?key=eitIfKhYnv0LrkdsyHqIros8fbsheKRIslfsdngf&secret=Hello%20Secret%20Manager`\n\n Copy and remove the portion starting with the question mark\n `?key=...` from the **Target URL** field. Then remove the initial question\n mark, move the remaining portion `key=...` to the **Sensitive Query String**\n field.\n7. In the **Trigger on** section, select one of the following:\n\n - **Push**: to trigger on a push to the repository.\n - **Pull request state changed**: to trigger on a change in the pull request state.\n8. If you selected **Push** , then you can enter an allowlist for push events in\n the **Branch filter** field.\n\n The **Branch filter** field uses the glob pattern and only operations on the\n matched branches will cause a build trigger. If the field is empty or `*`,\n then push events for all branches are reported. For information on syntax,\n see the [glob](https://pkg.go.dev/github.com/gobwas/glob) documentation.\n9. Click **Add webhook**.\n\n10. The webhook is displayed in the **Webhooks** page.\n\n | **Note:** When you add or edit a webhook, the length of the `Sensitive Query String` might be inconsistent with the entered one, which is expected as placeholder strings are used to ensure security.\n\nTest your webhook\n-----------------\n\n1. In the Secure Source Manager **Webhooks** page, click the webhook you want to test.\n2. Go to the bottom of the page and click **Test delivery**.\n\n A placeholder event is added to the delivery queue. It might take a few\n seconds before it shows up in the delivery history.\n3. You can also use a `git` command to push or merge a pull request to test the\n webhook.\n\n4. Check the status of the triggered build or event in the build history of the\n service where you configured your webhook trigger.\n\n5. You can also view the **Request** and **Response** to the test delivery\n in the **Recent deliveries** section of the Secure Source Manager\n webhook page after you send your first test delivery.\n\nSubstitute Cloud Build YAML variables with payload data\n-------------------------------------------------------\n\nIf you're using webhooks to connect to Cloud Build, you can substitute\nCloud Build YAML variables with Secure Source Manager webhook payload\ndata.\n\n1. In the Secure Source Manager **Webhooks** page, in the **Recent deliveries**\n section, click the top row.\n\n The **Request** header and content sent by the webhook payload is displayed.\n2. Navigate to the Cloud Build dashboard, and then click **Triggers**.\n\n3. Click the trigger you want to configure.\n\n4. In the **Advanced section** , under **Substitution variables** , click\n **+ Add variable**.\n\n5. Enter the name and value of the variable. The value prefix is `body`.\n\n For example, to substitute `_REPO_URL` with the payload data field\n `repository.clone_url` and `_COMMIT_SHA` with latest commit sha in\n Cloud Build YAML, enter the following names and values:\n - Variable 1: `_REPO_URL` Value 1: `$(body.repository.clone_url)`\n - Variable 2: `_COMMIT_SHA` Value 2: `$(body.after)`\n\n The Cloud Build YAML file resembles the following: \n\n steps:\n - name: gcr.io/cloud-builders/git\n env:\n - '_REPO_URL=$_REPO_URL'\n - '_COMMIT_SHA=$_COMMIT_SHA'\n script: |\n #!/bin/sh\n git clone ${_REPO_URL} /workspace\n cd /workspace\n git reset --hard ${_COMMIT_SHA}\n\nWhat's next\n-----------\n\n- [Connect to Jenkins](/secure-source-manager/docs/connect-jenkins)"]]