Integration with GitLab
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 for Managed Service for GitLab.
Create a hook for integration
To create a webhook for linking issues to merge requests:
- If you don't have a robot, create one: How to create a robot. Requests to the Tracker API will be sent on behalf of the robot.
- Obtain an OAuth token on behalf of the robot for accessing 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 your GitLab instance.
- In the left panel, click the Your work drop-down list and select Admin Area.
- Go to System Hooks.
- Specify the hook parameters:
-
URL —
https://api.tracker.yandex.net/v3/system/gitlab/receive?comments=true.The
comments=trueparameter 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. -
Secret token: OAuth token of the bot that will be used to add the links, in
OAuth <token_contents>format.
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.
The System Hooks 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.
An issue key is the unique ID of an issue. It consists of the queue key and the sequence number, for example: TEST-123. You can use this key to access the corresponding issue via a link: https://tracker.yandex.com//TEST-123.