GitLab
You can integrate your GitLab repository with Yandex Tracker to display links to commits and merge requests in issues.
To add a commit or merge request link to an issue, specify the issue key in the commit comment or merge request description: for example, Fixing error TEST-123. For more information, see Integration with repositories.
-
To set up links between issues in Yandex Tracker and commits, you can use one of the following methods:
-
Configure a webhook in the repository. We recommend using this sync method if you have an on-premises GitLab repository. This approach allows for faster data synchronization, so new commits will appear in the dedicated Yandex Tracker issue almost immediately.
-
Configure periodic repository polling. Yandex Tracker will periodically poll the repository for information about commits.
You can configure this sync method for repositories hosted online or deployed on-premises.
Configuring repository polling
When polling a repository, links to commits may appear in Yandex Tracker with a delay of up to 10 hours.
-
-
To set up links between issues in Yandex Tracker and merge requests, you can create a webhook in your repository that will access the Tracker API and transmit merge request data.
Configuring a webhook for commits in the repository
Syncing commits via a webhook is available for on-premises repositories.
-
In Yandex Tracker, obtain a URL and a token to configure the webhook: How to obtain a URL and token.
-
Open your GitLab instance and go to the hook settings:
- To enable integration for the entire GitLab instance (GitLab admin privileges are required):
- In the left panel, click the Your work drop-down list and select Admin Area.
- Go to System Hooks.
- To enable integration for an individual project:
- Go to the project you need.
- In the left panel, click Settings and select Webhooks.
- To enable integration for the entire GitLab instance (GitLab admin privileges are required):
-
In the URL field, enter the URL you copied in Yandex Tracker.
-
In the Secret token field, enter the token you copied in Yandex Tracker.
-
In the Trigger section, disable all options except Push events.
-
In the SSL verification section, select Enable SSL verification.
-
Click Add system hook (Add webhook for an individual project).
To make sure the webhook is running properly:
-
Create or select an existing issue in Yandex Tracker where you will test a link to a commit.
-
Create a commit in your repository and specify the issue key in its comment, for example,
Fixing error TEST-123. -
Make sure the Commits tab on the issue page in Yandex Tracker displays information about your commit.
Configuring a webhook for merge requests in the repository
To set up links between issues in Yandex Tracker and merge requests, create a webhook in your GitLab repository that will access the Tracker API and transmit merge request data.
To link a merge request to an issue, specify the issue key in the name or description of the new merge request. You'll find the merge request link on the issue page under Links to external applications.
You can also enable automatic creation of issue comments with information about merge requests. Auto comments are only available when using Managed Service for GitLab.
Create a hook for integration
To create a webhook for linking issues to merge requests:
-
Create a technical account in your organization that will send requests to the Yandex Tracker API: Managing users.
-
Obtain an OAuth token for the created technical account to access the Yandex Tracker API: How to obtain a token.
-
Check if you have access to the API using the request Getting information about the current user.
-
Open a GitLab instance and go to the hook settings:
- To enable integration for the entire GitLab instance (GitLab admin privileges are required):
- In the left-hand panel, click the Your work dropdown list and select Admin Area.
- Go to System Hooks.
- To enable integration for an individual project:
- Go to the project you need.
- In the left-hand panel, click Settings and select Webhooks.
- To enable integration for the entire GitLab instance (GitLab admin privileges are required):
-
Specify the hook parameters:
-
URL:
https://api.tracker.yandex.net/v3/system/gitlab/receive?comments=true&<organization_type>=<organization_ID>Where:
-
comments=true: Enables automatic creation of comments in an issue with a link to and information about merge requests. Remove this parameter from the URL if you don't need comments. This parameter is only available for Managed Service for GitLab. -
<organization_type>: It may take the following values:x_cloud_org_id: For a Yandex Cloud Organization.x_org_id: For a Yandex 360 for Business organization.
-
<organization_ID>To get the organization ID, go to Administration → Organizations and copy the value from the ID field.
-
-
Secret token: The technical account's OAuth token that you obtained, which looks like
OAuth <token_contents>.
For example:OAuth y1_AQAD-qJScA********. -
In the Trigger section, disable all options except Merge request events.
-
In the SSL verification section, select Enable SSL verification.
-
-
Click Add system hook (Add webhook for an individual project).
The System Hooks (Project Hooks for an individual project) section with information about the created hook and its parameters will appear on the page.
Test the hook
- Click Test under System Hooks (Project Hooks for an individual project).
- Select Merge request events from the drop-down list.
A test request should return a response saying Hook executed successfully: HTTP 204. If the test request returns an error, the hook parameters are incorrect.
Check the result
To make sure the webhook is running properly:
-
Create or select an existing issue in Yandex Tracker where you will test a link to a commit.
-
Create a merge request in your repository and specify the issue key in its name or description, for example,
Fixing error TEST-123. -
Make sure the Links to external applications tab on the issue page in Yandex Tracker displays information about your merge request.
If you used Managed Service for GitLab and enabled auto comments when creating a webhook, the issue will show a comment with the merge request link and details.
Learn more
Configuring repository polling
Integrating an online repository
To connect your repository on GitLab to Yandex Tracker:
Private repositories can only be accessed by users logged in to GitLab (Internal project) or the project team (Private project).
-
Obtain a token on GitLab to access your repository. For details on how to get a token, see the GitLab documentation. For the proper operation of Yandex Tracker, enable the read_repository and read_api options when setting up permissions.
-
Make sure you are authorized in Tracker as an administrator.
-
In Yandex Tracker, in the left-hand panel, click → Administration and then open Repositories.
-
Click Add and select Repository.
-
Choose GitLab in the Platform field.
-
Choose gitlab.com for the Server address option.
-
In the Repository field, enter the address in this format
https://gitlab.com/<repository_owner_login>/<repository_name>, then specify the access token. -
Click Add.
-
Make sure that the repository status in Yandex Tracker is Connected.
Integrating an on-premises repository
Before continuing, obtain a token to access the repository. For instructions on how to obtain an OAuth token, see the GitLab documentation. For the proper operation of Yandex Tracker, enable the read_repository and read_api options when setting up permissions.
To integrate an on-premises repository with Yandex Tracker:
-
Make sure you are authorized in Tracker as an administrator.
-
In Yandex Tracker, in the left-hand panel, click → Administration and then open Repositories.
-
Click Add and select Repository.
-
In the Platform field, select the type of your repository.
-
Choose Own for the Server address option.
-
In the Repository field, specify the URL of the repository on your server. Make sure that you connect to the server using the OAuth 2.0 technology.
-
In the Token from platform field, enter the token for connecting to your server.
-
Click Add.
-
Make sure that the repository status in Yandex Tracker is Connected.
The task key is a unique identifier for the task. It consists of a queue key and a sequence number, for example: TEST-123. Using the key, you can navigate to the task using the link: https://tracker.yandex.com//TEST-123.