Tracker integration with Cloud Functions
This guide describes how you can integrate Tracker automation tools with Cloud Functions using the example of calculating the total time spent across all child sub-issues for the parent issue.
To configure the total time spent value of a parent issue to automatically update whenever this value changes in any of its child sub-issues:
- Register the application.
- Get an application access token.
- Get an organization ID to access the API.
- Create a Cloud Functions function.
- Set up a trigger.
- Test out automatic data updates.
Getting started
Note
To run the scenario, you will need:
- Yandex Cloud billing account.
- Tracker account belonging to an organization connected to Yandex 360 for Business with a role no lower than
organization-manager.admin
.
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.
Required paid resources
The cost of infrastructure support includes a fee for function invocations (see Yandex Cloud Functions pricing).
If you no longer need the resources you created, delete them.
Register the application
- Open
https://oauth.yandex.ru/client/new
in your browser and log in with your Tracker account. - In the Create app form:
- In the Service name field, enter a name, e.g.,
TimeUpdater
. - Under Platforms, enable Web services, and enter
https://oauth.yandex.ru/verification_code
in the Redirect URI field. - Under Data access, in the input field, start typing
tracker
. Then, from the drop-down list, select:Read from Tracker
Write in Tracker
- In the Service name field, enter a name, e.g.,
- Click Create app.
- Wait for the page with the application details to load and copy your application ID from the ClientID field.
Get an application access token
- In the browser, go to:
https://oauth.yandex.ru/authorize?response_type=token&client_id=<app_ID>
client_id
parameter value is the application ID from the ClientID field on the application details page from the previous step. - Wait for the page to load and copy the token.
- Save the token. You will need it to create a function.
Get an organization ID to access the API
- Go to Tracker
. Click Logging in to Yandex Tracker. - In the right-hand panel, click Administration.
- Under Access and payment, click Organizations.
- Under Yandex 360 for Business, copy and save your organization ID. You will need it to create a function.
Create a Cloud Functions function
- Go to the management console
. - In the top-left corner, click
All services. - Select Serverless computing → Cloud Functions.
- Click Create function.
- Enter a function name, e.g.,
timeupdater
. - Click Create.
- In the Editor window that opens, select
Python / 3.9
as the runtime environment. - Click Continue.
- In the Method field, click ZIP archive.
- Attach a test archive
. - In the Entry point field, specify
index.handler
. - Under Parameters, in the Environment variables field, add:
ORG
: Yandex 360 for Business organization IDTOKEN
: Application access token
- Click Save changes.
- Wait for the page to load. Then, in the Link to invoke field, copy and save the function invocation link.
Here is an example of such a link:https://functions.yandexcloud.net/d4e94uav3108********
- Enable the Public function option.
Set up a trigger
Create a queue
- On the left-hand panel, select
Queues → Create queue. - Select a queue template, e.g., Basic development model.
- Enter a name, e.g.,
Function Test
. - Click Create.
Create a trigger
- In the top-right corner of the queue page, click
Queue settings. - On the left-hand panel, select Automation → Triggers and click Create trigger.
- In the Name field, enter a trigger name, e.g.,
timeupdater
. - Under Trigger conditions, select Time tracking → Time spent.
- Under Trigger actions, select HTTP request.
- In the form that opens, in the Address field, enter:
https://functions.yandexcloud.net/<function_ID>?id={{issue.key}}
https://functions.yandexcloud.net/<function_ID>
is the function invocation link you saved when creating the function.
For example:https://functions.yandexcloud.net/d4e94uav3108********?id={{issue.key}}
- Click Create.
Test out automatic data updates
Create issues
- Create a parent issue whose total time spent across all sub-issues will be calculated:
- On the
Function Test
queue page, click Create issue. - In the form that opens, in the Issue name field, enter an issue name, e.g.,
Parent Task
. - Click Create.
- On the
- Create sub-issues:
- In the top-right corner of the
Parent Task
issue page, in the Actions menu, select Add sub-issue. - In the form that opens, in the Issue name field, enter a sub-issue name, e.g.,
Subtask-1
. - In the same way, create another sub-issue or multiple sub-issues named
Subtask-2
,Subtask-3
, etc.
- In the top-right corner of the
Enter time spent values for the sub-issues
- In the top-right corner of the
Subtask-1
sub-issue page, in the Actions menu, select Add time spent. - In the dialog that opens, in the Time spent field, enter any time value, e.g.,
1h25m
. - In the same way, add time spent values for the other sub-issues.
Check if the function works correctly
- Go to the
Parent Task
issue page. - In the issue properties, under Time Tracking, make sure that the Time Spent field includes the time you specified in the sub-issue.
How to delete the resources you created
To stop paying for the resources you created, delete the Cloud Functions function.