Edit on GitHub

GitLab integration

Creating the GitLab Application

  1. Go to Admin Area -> Applications -> Applications -> New application Fill out the details as follows

studio selfhosted gitlab 1

  1. Replace localhost:8080 with your DVC Studio domain and port if applicable.
  2. Click Save application
  3. Copy the Application ID and Secret

studio selfhosted gitlab 2

Creating the webhook

The webhooks are created automatically per repository. To check if the webhook got created:

  1. Go to repository Settings -> Webhooks
  2. Scroll down to see Project Hooks
  3. Check if there is a hook pointing to your DVC Studio instance:

studio selfhosted gitlab 3

Configuring DVC Studio with the GitLab App

Merge the values.yaml file with the following contents:

global:
  scmProviders:
    # Optional
    # This is useful in cases where DVC Studio is on an internal
    # network, but the webhook endpoint is on an external network.
    # Default: `global.host` value.
    #webhookHost: ""
    gitlab:
      enabled: true

      # Set this if you're hosting GitLab on a
      # custom domain
      url: <GitLab URL>

      clientId: <GitLab OAuth App Client ID>
      secretKey: <GitLab OAuth App Secret Key>
      webhookSecret: <GitLab Webhook Secret>

Replace the strings marked with < >

Troubleshooting

GitLab Webhook didn’t get created

If there is no webhook in the repository, it is likely due to the GitLab instance settings.

By default, GitLab blocks webhook requests to local networks. To fix this, you need to whitelist your domain in GitLab:

  1. Open Admin Area in GitLab
  2. Go to Settings -> Network

studio selfhosted gitlab 4

  1. Expand the Outbound requests panel

studio selfhosted gitlab 5

  1. Select the checkbox: Allow requests to the local network from system hooks

  2. In the textbox, Local IP addresses and domain names that hooks and services may access, either write:

    • your studio domain, e.g. studio.example.com
    • IP network range, e.g. 10.0.0.0/16

    So if DVC Studio is configured with https://studio.example.com, write:

    studio.example.com

More examples of using the allowlist can be found in GitLab’s documentation: Create an allowlist for local requests

Content

🐛 Found an issue? Let us know! Or fix it:

Edit on GitHub

Have a question? Join our chat, we will help you:

Discord Chat