Secure Source Manager에 연결

이 페이지에서는 Secure Source Manager에 연결하고 Secure Source Manager 저장소에 연결하는 방법을 설명합니다. 이 통합을 통해 Secure Source Manager 저장소의 대시보드 뷰와 같은 Developer Connect 기능을 사용하고 Developer Connect 프록시를 사용하여 보안 읽기 작업과 같은 git 작업을 실행할 수 있습니다.

시작하기 전에

  1. Google 계정에 로그인합니다.

    아직 계정이 없으면 새 계정을 등록하세요.

  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  3. Verify that billing is enabled for your Google Cloud project.

  4. Enable the Developer Connect API.

    Roles required to enable APIs

    To enable APIs, you need the Service Usage Admin IAM role (roles/serviceusage.serviceUsageAdmin), which contains the serviceusage.services.enable permission. Learn how to grant roles.

    Enable the API

  5. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  6. Verify that billing is enabled for your Google Cloud project.

  7. Enable the Developer Connect API.

    Roles required to enable APIs

    To enable APIs, you need the Service Usage Admin IAM role (roles/serviceusage.serviceUsageAdmin), which contains the serviceusage.services.enable permission. Learn how to grant roles.

    Enable the API

  8. 선택사항: Developer Connect에서 만드는 인증 보안 비밀을 암호화하기 위한 고객 관리 암호화 키 (CMEK)를 만듭니다.
  9. 선택사항: 이 가이드의 명령줄 안내를 사용하려면 다음 단계를 완료하세요.
    1. Google Cloud CLI 설치 이전에 gcloud CLI를 설치한 경우 gcloud components update를 실행하여 최신 버전을 사용할 수 있는지 확인합니다.
    2. 다음 명령어를 실행하여 Developer Connect 서비스 계정을 만듭니다. 여기서 PROJECT_IDGoogle Cloud 프로젝트 ID입니다.
              gcloud beta services identity create \
                  --service=developerconnect.googleapis.com \
                  --project=PROJECT_ID
              

Secure Source Manager 요구사항

  • Google Cloud 리전에 배포된 작동 가능한 Secure Source Manager 인스턴스가 있는지 확인합니다.
  • Developer Connect 연결과 Secure Source Manager 인스턴스가 동일한 리전에 있어야 합니다.
  • Secure Source Manager 인스턴스의 프로젝트에서 Developer Connect 서비스 에이전트 (P4SA)에 roles/securesourcemanager.developerConnectLinker 역할을 부여합니다.

필요한 역할

연결 및 링크를 만드는 데 필요한 권한을 얻으려면 관리자에게 다음 IAM 역할을 부여해 달라고 요청하세요.

역할 부여에 대한 자세한 내용은 프로젝트, 폴더, 조직에 대한 액세스 관리를 참조하세요.

커스텀 역할이나 다른 사전 정의된 역할을 통해 필요한 권한을 얻을 수도 있습니다.

연결 만들기

이 섹션에서는 Developer Connect와 Secure Source Manager 간의 연결을 만드는 방법을 설명합니다. Google Cloud 콘솔을 사용하는 경우 연결 설정을 완료할 때 저장소 링크 추가를 시작할 수도 있습니다.

새 Secure Source Manager 연결을 만들려면 다음 옵션 중 하나를 선택하세요.

콘솔

  1. Google Cloud 콘솔에서 Developer Connect를 엽니다.

    Developer Connect로 이동

  2. 연결 만들기를 클릭합니다.

  3. Secure Source Manager를 소스 제공업체로 선택합니다.

  4. 리전에서 연결의 리전을 선택합니다. Secure Source Manager 인스턴스와 동일한 리전이어야 합니다.

  5. 이름에 연결 이름을 입력합니다.

  6. 인스턴스 목록에서 인스턴스를 선택합니다.

  7. 선택적 구성 설정을 보려면 더보기를 클릭합니다.

  8. 선택사항: Developer Connect 프록시를 사용 중지하려면 Developer Connect 프록시 사용 설정 체크박스를 선택 취소합니다.

  9. 계속을 클릭합니다.

  10. 지금 저장소에 연결하거나 나중에 연결을 수정하여 연결할 수 있습니다. 저장소에 연결하려면 목록에서 저장소를 선택합니다.

  11. 링크를 클릭합니다.

Developer Connect는 저장소 링크를 만들어 Google Cloud 콘솔에 표시합니다.

gcloud

Google Cloud CLI를 사용하여 Developer Connect 연결을 만들려면 다음 명령어를 실행합니다.

gcloud developer-connect connections create CONNECTION_ID \
  --location=REGION \
  --project=CONNECTION_PROJECT_ID \
  --secure-source-manager-instance-config=projects/INSTANCE_PROJECT_ID/locations/REGION/instances/INSTANCE_ID

각 항목의 의미는 다음과 같습니다.

  • CONNECTION_ID는 만들려는 Developer Connect 연결의 ID입니다.
  • REGION은 연결의 리전입니다. Secure Source Manager 인스턴스와 동일한 리전이어야 합니다.
  • CONNECTION_PROJECT_ID는 연결을 만들려는 Google Cloud 프로젝트의 ID입니다.
  • INSTANCE_PROJECT_ID는 Secure Source Manager 인스턴스가 있는 Google Cloud 프로젝트의 ID입니다.
  • INSTANCE_ID은 Secure Source Manager 인스턴스의 ID입니다.

curl

curl로 Developer Connect 연결을 만들려면 다음 API 호출을 실행하세요.

curl -H "Authorization: Bearer $(gcloud auth print-access-token)" \
https://developerconnect.googleapis.com/v1/projects/CONNECTION_PROJECT_ID/locations/REGION/connections?connection_id=CONNECTION_ID \
-X POST -H "Content-Type: application/json" \
-d '{"secure_source_manager_instance_config":{"instance":"projects/INSTANCE_PROJECT_ID/locations/REGION/instances/INSTANCE_ID"}}'

각 항목의 의미는 다음과 같습니다.

  • CONNECTION_ID는 만들려는 Developer Connect 연결의 ID입니다.
  • REGION은 연결의 리전입니다. Secure Source Manager 인스턴스와 동일한 리전이어야 합니다.
  • CONNECTION_PROJECT_ID는 연결을 만들려는 Google Cloud 프로젝트의 ID입니다.
  • INSTANCE_PROJECT_ID는 Secure Source Manager 인스턴스가 있는 Google Cloud 프로젝트의 ID입니다.
  • INSTANCE_ID은 Secure Source Manager 인스턴스의 ID입니다.

Secure Source Manager에 연결되면 저장소에 연결할 수 있습니다. 나중에 필요에 따라 이 단계를 반복하여 저장소를 추가로 연결할 수 있습니다.

기존 Secure Source Manager 연결에 저장소 링크를 만들려면 다음 옵션 중 하나를 선택하세요.

콘솔

  1. Google Cloud 콘솔에서 저장소 페이지를 엽니다.

    저장소 페이지 열기

  2. 저장소 연결을 클릭합니다.

    Git 저장소 연결 창이 열립니다.

  3. 연결 목록에서 Secure Source Manager 연결을 선택합니다.

  4. 계속을 클릭합니다.

  5. 저장소 목록에서 연결할 저장소를 선택합니다.

  6. 만들기를 클릭합니다.

Developer Connect는 저장소 링크를 만들어 Google Cloud 콘솔에 표시합니다.

gcloud

gcloud로 Git 저장소 링크를 관리하는 방법에 관한 자세한 내용은 gcloud developer-connect connections git-repository-links를 참고하세요.

Cloud Build에서 Developer Connect 프록시 사용

Cloud Build에서 Developer Connect 프록시를 사용하려면 다음 단계를 따르세요.

  1. Developer Connect 프로젝트에서 Secure Source Manager 서비스 에이전트에게 roles/developerconnect.viewer 역할 또는 developerconnect.gitRepositoryLinks.get 권한이 있는 역할을 부여합니다.
  2. Secure Source Manager 저장소를 Developer Connect gitRepositoryLink에 연결합니다. 자세한 내용은 Secure Source Manager 저장소에 연결을 참고하세요.
  3. 저장소 루트 디렉터리의 .cloudbuild/trigger.yaml 파일에서 타겟 gitRepositoryLink 리소스를 가리키는 새 항목을 추가합니다.

    예를 들면 다음과 같습니다.

    triggers:
    - name: test-trigger
      project: my-project
      configFilePath: cloudbuild.yaml
      eventType: push
      serviceAccount: projects/my-project/serviceAccounts/my-sa@my-project.iam.gserviceaccount.com
      devConnectGitRepositoryLink: projects/my-project/locations/us-central1/connections/my-ssm-connection/gitRepositoryLinks/my-repo-link
    

운영 범위 및 제한사항

연결을 구성한 후 Developer Connect 프록시 URI를 사용하여 Secure Source Manager 인스턴스에서 clone와 같은 보안 git 읽기 작업을 실행할 수 있습니다.

Developer Connect 프록시는 git push 작업을 지원하지 않습니다. 시스템은 DevConnect P4SA의 ID를 사용하는 쓰기 작업을 방지합니다.

Developer Connect 프록시를 사용 설정하거나 사용 중지하는 등 연결의 다른 구성을 업데이트할 수 있지만 기존 연결을 다른 Secure Source Manager 인스턴스로 지정할 수는 없습니다.

다음 단계