HEX
Server: Apache/2.4.65 (Ubuntu)
System: Linux ielts-store-v2 6.8.0-1036-gcp #38~22.04.1-Ubuntu SMP Thu Aug 14 01:19:18 UTC 2025 x86_64
User: root (0)
PHP: 7.2.34-54+ubuntu20.04.1+deb.sury.org+1
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
Upload Files
File: //snap/google-cloud-cli/current/lib/surface/builds/connections/create/gitlab.yaml
- help_text:
    brief: Create a Cloud Build Connection for gitlab.com or GitLab Enterprise.
    description: |
      Create a Cloud Build Connection for gitlab.com or GitLab Enterprise.

      A gitlab.com or GitLab Enterprise Connection can be created by using a personal access token with `api`
      scope permission. A `read_repository` scoped personal access token will also be required on gitlab.com or if
      the self-hosted GitLab server doesn't support project access token (GitLab Enterprise server version <
      13.10).

      If the GitLab Enterprise server can only be accessed within a VPC, a Service Directory
      service resource can be provided for connecting to it.

    examples: |
      To create a GitLab connection for gitlab.com,
      provide all the required parameters:

        $ {command} my-gitlab-conn \
          --project=myproj --region=us-central1 \
          --read-authorizer-token-secret-version=projects/myproj/secrets/read-pat/versions/1 \
          --authorizer-token-secret-version=projects/myproj/secrets/api-pat/versions/1 \
          --webhook-secret-secret-version=projects/myproj/secrets/whsecret/versions/1

      To create a GitLab connection for a GitLab server,
      provide host-uri parameter as well:

        $ {command} my-gle-conn \
          --host-uri=https://my.gle-server.net \
          --project=myproj --region=us-central1 \
          --authorizer-token-secret-version=projects/myproj/secrets/api-pat/versions/1 \
          --read-authorizer-token-secret-version=projects/myproj/secrets/read-pat/versions/1 \
          --webhook-secret-secret-version=projects/myproj/secrets/whsecret/versions/1

      To create a GitLab connection for a private GitLab server.
      provide the service-directory-service and ssl-ca-file as well:

        $ {command} my-gle-conn \
          --host-uri=https://my.private-gle-server.net \
          --project=myproj --region=us-central1 \
          --service-directory-service=projects/myproj/namespaces/x/services/mysds \
          --ssl-ca-file=mycertificate.crt \
          --authorizer-token-secret-version=projects/myproj/secrets/api-pat/versions/1 \
          --read-authorizer-token-secret-version=projects/myproj/secrets/read-pat/versions/1 \
          --webhook-secret-secret-version=projects/myproj/secrets/whsecret/versions/1

  command_type: CREATE
  request:
    collection: cloudbuild.projects.locations.connections
    api_version: v2
  arguments:
    resource:
      help_text: Connection to create.
      spec: !REF googlecloudsdk.command_lib.cloudbuild.resources_v2:connection
    params:
    - api_field: connection.gitlabConfig.hostUri
      arg_name: host-uri
      help_text: URI of the GitLab instance.
    - api_field: connection.gitlabConfig.authorizerCredential.userTokenSecretVersion
      arg_name: authorizer-token-secret-version
      help_text: Secret containing the api personal access token.
      required: true
    - api_field: connection.gitlabConfig.readAuthorizerCredential.userTokenSecretVersion
      arg_name: read-authorizer-token-secret-version
      help_text: Secret containing the read_api personal access token.
      required: true
    - api_field: connection.gitlabConfig.webhookSecretSecretVersion
      arg_name: webhook-secret-secret-version
      required: true
      help_text: |-
        Secret containing the webhook secret string for validating webhook events sent by
        GitLab.
    - group:
        help_text: Group of arguments for configuring access through Service Directory.
        params:
        - api_field: connection.gitlabConfig.serviceDirectoryConfig.service
          arg_name: service-directory-service
          required: true
          help_text: Service Directory service resource to use for accessing the gitlab.com or GitLab Enterprise
            Server. Necessary only if the server has no public access from the internet.
        - api_field: connection.gitlabConfig.sslCa
          arg_name: ssl-ca-file
          help_text: File containing the SSL_CA to be used.
          processor: googlecloudsdk.core.util.files:ReadFileContents
  async:
    collection: cloudbuild.projects.locations.operations