Skip to content

How to Connect Teamscale to GitLab

Screenshot of the GitLab Plugin's Findings Badge

Teamscale integrates with GitLab using the available API and web hooks. No global configuration is required.

General Option Reference

This guide only covers the options specific for the GitLab repository connector. A general overview of connector options is available here.

To connect a project to code from a GitLab project, follow these steps:

  1. Ensure that the Teamscale instance base URL is configured correctly.

  2. Select the GitLab connector during project creation.

  3. Select or create an account for the GitLab server:

    • The account's URL should point to the GitLab server's root URL (i.e., it is not project specific).

    • The username can be empty (ignored).

    • The password is a personal access token of a GitLab user with api scope.

      To obtain a personal access token in GitLab, navigate to your user's settings page and select the Access Tokens page. Additionally, to allow Teamscale to create web hooks in a project, the user needs to be a Maintainer of that project. Note that you can also create the web hooks manually

  4. Complete project creation as usual, by providing the name (e.g., my-user/my-project) or ID (e.g., 12345678) of the GitLab project and completing any other required fields. As the first step in project creation, Teamscale will register its web hook with the project. After this, Teamscale will automatically be informed about events in the project, such as pushes to the repository and changes to any merge requests.

Screenshot of the GitLab Plugin's Line Comments

Manual Creation of Webhooks

In case the technical user does not have at least a Maintainer role, you will need to manually create and configure webhooks in the GitLab repository.

  1. Open the GitLab repository you want to add the webhook to.
  2. From Settings, click Webhooks.
  3. Configure the webhook as follows:
    • URL: Enter the URL of Teamscale's GitLab endpoint. It should be in the following format: <Teamscale_baseURL>/api/gitlab/web-hook
    • Trigger: Select the following triggers:
      • Push events
      • Merge request events
  4. Click Add webhook.

TIP

If there are restrictions, so that Teamscale cannot receive GitLab web hooks or web hooks cannot be automatically created, please apply these advanced configuration options.