Menghubungkan ke GitLab

Halaman ini menjelaskan cara membuat koneksi ke GitLab dan membuat link ke repositori GitLab. Anda dapat menyelesaikan tugas ini menggunakan Konsol Google Cloud atau Google Cloud CLI.

Petunjuk ini ditujukan bagi developer aplikasi, administrator platform, dan pengelola keamanan yang ingin menggunakan repositori kode sumber GitLab dengan Google. Secara khusus, Anda dapat menggunakan repositori GitLab dengan Gemini Code Assist.

Untuk mempelajari Developer Connect lebih lanjut, lihat Ringkasan Developer Connect.

Sebelum memulai

  1. Login ke Akun Google Anda.

    Jika Anda belum memilikinya, Daftar untuk membuat akun baru.

  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 serviceusage.services.enable permission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). 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 serviceusage.services.enable permission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Learn how to grant roles.

    Enable the API

  8. Mengaktifkan Developer Connect juga akan mengaktifkan Secret Manager API.

  9. Pastikan Anda memiliki akses ke akun di GitLab.

    Untuk membantu menjaga keamanan pekerjaan tim Anda, sebaiknya selesaikan tugas dalam panduan ini menggunakan akun layanan atau akun yang dibagikan oleh tim Anda, bukan akun pribadi.

  10. Pastikan Anda memiliki repositori GitLab, atau memiliki izin tingkat admin di repositori bersama.
  11. Opsional: Buat kunci enkripsi yang dikelola pelanggan (CMEK) untuk mengenkripsi secret autentikasi yang dibuat Developer Connect.
  12. Opsional: Untuk menggunakan petunjuk command line dalam panduan ini, selesaikan langkah-langkah berikut:
    1. Instal Google Cloud CLI. Jika Anda telah menginstal gcloud CLI sebelumnya, pastikan Anda memiliki versi terbaru yang tersedia dengan menjalankan gcloud components update.
    2. Buat akun layanan Developer Connect dengan menjalankan perintah berikut, dengan PROJECT_ID adalah Google Cloud project ID Anda: