GitLab
Setting up a link
In Tracker issues, you can automatically add links to merge requests
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 link GitLab merge requests to Tracker issues, create a hook:
-
If you do not have an OAuth token for working with the Tracker API yet, get one.
-
Check if you have access to the API by requesting 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 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-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/v2/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. Disable it if commenting is not required. This parameter is only available for Managed Service for GitLab. -
<organization_type>
: It may take the following values:x_cloud_org_id
: If the type of your organization is Yandex Cloud Organization.x_org_id
: If the type of your organization is Yandex 360 for business or both Yandex 360 for business and Yandex Cloud Organization.
-
<organization_ID>
: ID of the organization from the Tracker organizations page .
-
-
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-qJScAAAEKEQbBNnChvfBIqR_yEQl_HMO0********
. -
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
- Under System Hooks (Project Hooks for an individual project), click Test.
- 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.
See also
Connecting a repository
To connect your repository on GitLab
Note
Private repositories can only be accessed by users logged in to GitLab (Internal project) or the project team (Private project).
-
Make sure you are authorized in Tracker as an administrator.
-
In the left-hand panel, click
and select Admin settings → Repositories → Connect. -
Choose GitLab in the Platform field.
-
Get an OAuth token for your repository on GitLab. For details on how to get a token, see the GitLab documentation
. For the proper operation of Tracker, enable the read_repository and read_api options when setting up permissions. -
Enter the repository address as
https://github.com/<repository_owner_login>/<repository_name>
and specify the access token. -
Click Connect.
-
Make sure that the repository status in Tracker is Connected.
To link a commit to an issue, specify the issue key in the comment to the commit.
Note
Please note that it takes some time for a commit to get linked to an issue.
To view the linked commits, select Show the Commits tab in the queue settings. You can view the linked commits:
- In the Commits tab on the issue page.
- On the queue commits page. To switch to the commits page from the queue page, click
→ Commits in the top-right corner.
Own server
To connect your own server to Tracker:
-
Make sure you are authorized in Tracker as an administrator.
-
In the left-hand panel, click
and select Admin settings → Repositories → Connect. -
In the Platform field, select the platform your server is connected to.
-
In the Link to repository field, specify your server address to any repository that can be accessed using a token.
-
Get an OAuth token for your repository on GitLab. For details on how to get a token, see the GitLab documentation
. For the proper operation of Tracker, enable the read_repository and read_api options when setting up permissions. -
In the Token field, enter the token for connecting to your server.
-
Click Connect.
-
Make sure that the repository status in Tracker is Connected.