Crea e accedi a un'istanza

Crea un'istanza Secure Source Manager e accedi alla relativa interfaccia web per prepararti a creare repository e concedere l'accesso agli utenti.

Prima di iniziare

  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. Se utilizzi un provider di identità (IdP) esterno, devi prima accedere a gcloud CLI con la tua identità federata.

  4. Per inizializzare gcloud CLI, esegui questo comando:

    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. Se utilizzi un provider di identità (IdP) esterno, devi prima accedere a gcloud CLI con la tua identità federata.

  10. Per inizializzare gcloud CLI, esegui questo comando:

    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. Installa il componente beta Google Cloud CLI:
    gcloud components install beta
  15. Ruoli obbligatori

    Per ottenere le autorizzazioni necessarie per creare un'istanza di Secure Source Manager, chiedi all'amministratore di concederti il ruolo IAM Instance Owner (roles/securesourcemanager.instanceOwner) nel progetto Google Cloud .

    I ruoli di Secure Source Manager non vengono visualizzati nella console Google Cloud finché non sono stati concessi a un'entità. Per concedere un ruolo Secure Source Manager per la prima volta, consulta Concedi e revoca i ruoli IAM.

    Crea un'istanza

    1. Esegui il comando seguente per creare un'istanza denominata my-instance nella us-central1 posizione. Potrebbe esserti chiesto di autenticarti in gcloud CLI.

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

      Dove:

      • my-instance è il nome dell'istanza.
      • us-central1 è la regione in cui stai creando l'istanza.

      Viene avviata un'operazione di creazione dell'istanza a lunga esecuzione. L'output è simile al seguente:

      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
      

      Dove:

      • projects/PROJECT_ID/locations/us-central1/operations/operation-1234567894561-5ec69948c0f2b-60dd727f-a9b97a2e è il OPERATION_NAME.
      • PROJECT_ID è l'ID progetto.

      La creazione dell'istanza richiede fino a 60 minuti.

    2. Prendi nota dell'OPERATION_NAME, in quanto dovrai utilizzarlo per controllare lo stato dell'operazione.

    3. Controlla lo stato dell'operazione create eseguendo questo comando:

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

      Sostituisci quanto segue:

      • OPERATION_NAME con il nome dell'operazione dalla risposta del comando create.

      Quando l'istanza è pronta, la risposta sarà simile alla seguente:

      {
      "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"
        }
      }
      }
      

      Dove:

      • my-instance-098765432109.us-central1.sourcemanager.dev è l'URL HTML dell'istanza.
      • PROJECT_ID è l'ID progetto.
    4. Copia l'URL HTML dal comando di stato del controllo creato correttamente. Avrai bisogno di questo URL per accedere all'istanza tramite browser web.

    Accedere a un'istanza

    Una volta creata l'istanza, puoi accedervi tramite la sua interfaccia web utilizzando un browser.

    1. Per ottenere l'URL HTML della tua istanza, esegui di nuovo questo comando:

         gcloud beta source-manager operations describe OPERATION_NAME \
          --region=us-central1
      
    2. Copia l'URL HTML dalla risposta corretta del comando gcloud beta source-manager operations describe nella barra degli indirizzi del browser.

    3. Viene visualizzata una schermata OAuth 2.0 che ti chiede se vuoi concedere a sourcemanager.dev l'accesso al tuo account Google Cloud .

    4. Fai clic sul pulsante Consenti.

    5. Si apre l'interfaccia web di Secure Source Manager. Puoi creare e visualizzare repository e tutti i problemi e le richieste di pull associati dall'interfaccia web.

    Esegui la pulizia

    Per evitare che al tuo account Google Cloud vengano addebitati costi relativi alle risorse utilizzate in questa pagina, elimina il progetto Google Cloud con le risorse.

      Delete a Google Cloud project:

      gcloud projects delete PROJECT_ID

    Passaggi successivi