Integration with Yandex Tracker
In Tracker issues, you can automatically add links to GitLab 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.
To set up integration with GitLab in Tracker:
- Connect Yandex Tracker.
- Create a GitLab instance.
- (Optional) Create a GitLab project.
- Create a hook for integration.
- Test the hook.
- Check the result.
If you no longer need the resources you created, delete them.
Getting started
Sign up for Yandex Cloud and create a billing account:
- Go to the management console
and log in to Yandex Cloud or create an account if you do not have one yet. - On the Yandex Cloud Billing
page, make sure you have a billing account linked and it has theACTIVE
orTRIAL_ACTIVE
status. If you do not have a billing account, create one.
If you have an active billing account, you can go to the cloud page
Learn more about clouds and folders.
Connect Yandex Tracker
Enable Tracker for your Yandex Cloud organization.
Create a GitLab instance
Create a Managed Service for GitLab instance or a VM with the GitLab image.
Create a Managed Service for GitLab instance by following this guide.
Launch GitLab on a VM with a public IP.
- On the folder page in the management console
, click Create resource and select Virtual machine instance. - In the Name field, enter the VM name as follows:
ci-tutorial-gitlab
. - Select an availability zone to place your VM in.
- Under Boot disk image, go to the Marketplace tab and click Show all Marketplace products. In the window that opens, select GitLab as your image and click Use.
- Under Computing resources, specify the following configuration:
- vCPU:
4
- Guaranteed vCPU performance:
100%
- RAM:
8 GB
- vCPU:
- Under Network settings:
-
Select a subnet to connect your VM to. If the required network or subnet is not listed, create it using the Create network and Create subnet buttons.
Warning
For the time being, Yandex Cloud technical restrictions do not allow selecting a subnet with an address range of
192.168.0.0/24
. -
In the Public IP field, select
Auto
.
-
- Under Access, specify the information required to access the instance:
-
Enter the username in the Login field.
Alert
Do not use the
root
username or other names reserved by the operating system. To perform operations that require superuser permissions, use thesudo
command. -
In the SSH key field, paste the contents of the public key file. You need to create a key pair for the SSH connection yourself. To learn how, see Connecting to a VM via SSH.
-
- Click Create VM.
It may take a few minutes to create the VM. When the VM changes its status to RUNNING
and GitLab starts, you can proceed to setup.
(Optional) Create a GitLab project
To set up integration for an individual GitLab project, create one.
-
Log in to the Managed Service for GitLab instance web interface.
-
Click Create a project.
-
Click Create blank project.
-
Fill out the fields below:
- Project name: Enter a name for the project.
- Project URL: Select the administrator user in the field next to the Managed Service for GitLab instance FQDN.
Leave the other fields unchanged.
-
Click Create project.
-
On the Yandex Compute Cloud page, select the created VM and copy its public IP.
-
Connect to the VM via SSH.
-
Get the GitLab administrator password using the following VM command:
sudo cat /etc/gitlab/initial_root_password
-
Copy the password (without spaces) from the
Password
row to the clipboard or a separate file. -
Open
http://<VM_public_IP_address>
in your browser. This will take you to the GitLab web interface. -
Log in using the administrator account:
- Username or email:
root
. - Password: Password you copied earlier.
If you are unable to log in, reset the administrator account password
. - Username or email:
-
Log in to the system again using the administrator account and the new password.
-
Select Create a project.
-
Give your project a name.
-
Click Create project.
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.
Check the result
-
Create an issue in Tracker.
-
Create a merge request
in GitLab and specify the issue key in its name or description. -
Make sure the Tracker issue now contains a link to the GitLab merge request under Links to external applications.
If you used Managed Service for GitLab and enabled auto comments when creating a hook, the issue will show a comment with the merge request link and details.
Delete the resources you created
Delete the resources you no longer need to avoid paying for them:
- Delete the Managed Service for GitLab instance or the created VM with the GitLab image.
- If you reserved a public static IP address for the VM, release and delete it.