インスタンスを作成してアクセスする

Secure Source Manager インスタンスを作成し、そのウェブ インターフェースにアクセスして、リポジトリの作成とユーザーへのアクセス権の付与の準備をします。

始める前に

  1. Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
  2. Install the Google Cloud CLI.

  3. 外部 ID プロバイダ(IdP)を使用している場合は、まず連携 ID を使用して gcloud CLI にログインする必要があります。

  4. gcloud CLI を初期化するには、次のコマンドを実行します。

    gcloud init
  5. Create or select 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 (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.
    • Create a Google Cloud project:

      gcloud projects create PROJECT_ID

      Replace PROJECT_ID with a name for the Google Cloud project you are creating.

    • Select the Google Cloud project that you created:

      gcloud config set project PROJECT_ID

      Replace PROJECT_ID with your Google Cloud project name.

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

  7. Enable the Secure Source Manager 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.

    gcloud services enable securesourcemanager.googleapis.com
  8. Install the Google Cloud CLI.

  9. 外部 ID プロバイダ(IdP)を使用している場合は、まず連携 ID を使用して gcloud CLI にログインする必要があります。

  10. gcloud CLI を初期化するには、次のコマンドを実行します。

    gcloud init
  11. Create or select 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 (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.
    • Create a Google Cloud project:

      gcloud projects create PROJECT_ID

      Replace PROJECT_ID with a name for the Google Cloud project you are creating.

    • Select the Google Cloud project that you created:

      gcloud config set project PROJECT_ID

      Replace PROJECT_ID with your Google Cloud project name.

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

  13. Enable the Secure Source Manager 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.

    gcloud services enable securesourcemanager.googleapis.com
  14. beta Google Cloud CLI コンポーネントをインストールします。
    gcloud components install beta
  15. 必要なロール

    Secure Source Manager インスタンスの作成に必要な権限を取得するには、 Google Cloud プロジェクトに対するインスタンス オーナー roles/securesourcemanager.instanceOwner)IAM ロールの付与を管理者に依頼してください。

    Secure Source Manager のロールは、プリンシパルに付与されるまで Google Cloud コンソールに表示されません。Secure Source Manager ロールを初めて付与するには、IAM ロールを付与して取り消すをご覧ください。

    インスタンスの作成

    1. 次のコマンドを実行して、us-central1 ロケーションmy-instance という名前のインスタンスを作成します。gcloud CLI への認証を求められることがあります。

      gcloud beta source-manager instances create my-instance \
          --region=us-central1
      

      ここで

      • my-instance はインスタンス名です。
      • us-central1 は、インスタンスを作成するリージョンです。

      長時間実行のインスタンス作成オペレーションが開始されます。出力は次のようになります。

      Create request issued for [my-instance].
      done: false
      metadata:
        '@type': type.googleapis.com/google.cloud.securesourcemanager.v1.OperationMetadata
        apiVersion: v1
        createTime: '2023-02-27T20:57:52.315609549Z'
        requestedCancellation: false
        target: projects/PROJECT_ID/locations/us-central1/instances/my-instance
        verb: create
      name: projects/PROJECT_ID/locations/us-central1/operations/operation-1234567894561-5ec69948c0f2b-60dd727f-a9b97a2e
      

      ここで

      • projects/PROJECT_ID/locations/us-central1/operations/operation-1234567894561-5ec69948c0f2b-60dd727f-a9b97a2eOPERATION_NAME です。
      • PROJECT_ID はプロジェクト ID です。

      インスタンスの作成には最大 60 分かかります。

    2. OPERATION_NAME は、オペレーションのステータスを確認するために使用する必要があるため、メモしておきます。

    3. 次のコマンドを実行して、create オペレーションのステータスを確認します。

      gcloud beta source-manager operations describe OPERATION_NAME \
          --region=us-central1
      

      次のように置き換えます。

      • OPERATION_NAME: 作成コマンドのレスポンスから取得したオペレーション名。

      インスタンスの準備が完了すると、次のようなレスポンスが返されます。

      {
      "name": "projects/PROJECT_ID/locations/us-central1/operations/operation-123456789012-5ec69948c0f2b-60dd727f-a9b97a2e",
      "metadata": {
        "@type": "type.googleapis.com/google.cloud.securesourcemanager.v1.OperationMetadata",
        "createTime": "2022-11-01T14:31:32.420469714Z",
        "endTime": "2022-11-01T14:48:34.140378114Z",
        "target": "projects/PROJECT_ID/locations/us-central1/instances/my-instance",
        "verb": "create",
        "requestedCancellation": false,
        "apiVersion": "v1"
      },
      "done": true,
      "response": {
        "@type": "type.googleapis.com/google.cloud.securesourcemanager.v1.Instance",
        "name": "projects/PROJECT_ID/locations/us-central1/instances/my-instance",
        "createTime": "2022-11-01T14:31:32.416413630Z",
        "updateTime": "2022-11-01T14:31:32.416413630Z"
        },
        "state": "ACTIVE",
        "hostConfig": {
          "html": "my-instance-098765432109.us-central1.sourcemanager.dev",
          "api": "my-instance-098765432109-api.us-central1.sourcemanager.dev",
          "gitHttp": "my-instance-098765432109-git.us-central1.sourcemanager.dev"
        }
      }
      }
      

      ここで

      • my-instance-098765432109.us-central1.sourcemanager.dev はインスタンスの HTML URL です。
      • PROJECT_ID はプロジェクト ID です。
    4. 正常に作成されたステータス確認コマンドから HTML URL をコピーします。この URL は、ウェブブラウザからインスタンスにアクセスするために必要です。

    インスタンスにアクセスする

    インスタンスの作成後、ブラウザを使用してウェブ インターフェースからインスタンスにアクセスできます。

    1. インスタンスの HTML URL を取得するには、次のコマンドをもう一度実行します。

         gcloud beta source-manager operations describe OPERATION_NAME \
          --region=us-central1
      
    2. gcloud beta source-manager operations describe コマンドからの成功レスポンスから HTML URL をコピーし、ブラウザのアドレスバーに貼り付けます。

    3. OAuth 2.0 画面が表示され、sourcemanager.dev に Google Cloud アカウントへのアクセス権を付与するかどうかを尋ねられます。

    4. [許可] ボタンをクリックします。

    5. Secure Source Manager のウェブ インターフェースが開きます。ウェブ インターフェースから、リポジトリと関連するすべての問題と pull リクエストを作成して表示できます。

    クリーンアップ

    このページで使用したリソースについて、 Google Cloud アカウントに課金されないようにするには、リソースを含む Google Cloud プロジェクトを削除します。

      Delete a Google Cloud project:

      gcloud projects delete PROJECT_ID

    次のステップ