Working with a managed runner
Note
In Managed Service for GitLab, you can create a managed runner that automatically deploys a specified number of Compute Cloud VMs with installed GitLab workers. The managed runner also scales out the worker VMs to accommodate the load.
Warning
There is a fee for using VM instances (workers) (see Compute Cloud pricing).
Getting a GitLab Runner token
You can get a token when creating a GitLab Runner in GitLab. You specify this token when creating a runner in your Managed Service for GitLab instance and use it to authenticate the runner in GitLab.
To create and configure GitLab Runner for the entire GitLab instance, proceed as follows (GitLab admin permissions required):
- Open GitLab.
- In the bottom-left corner, click Admin.
- In the left-hand menu, select CI/CD → Runners.
- Click New instance runner and create a new GitLab Runner.
- Save the value of the
Runner authentication tokenparameter.
To create and set up GitLab Runner for a project
- Open GitLab.
- Select a project.
- In the left-hand menu, select Settings → CI/CD.
- Under Runners, click Expand.
- Click New project runner and create a new GitLab Runner.
- Save the value of the
Runner authentication tokenparameter.
Creating a runner
-
Select the Managed Service for GitLab instance you need to create a runner for.
-
Select the Runners tab.
-
Click Create Runner.
-
Enter a name for the runner:
- The name must be 2 to 63 characters long.
- It can only contain lowercase Latin letters, numbers, and hyphens.
- It must start with a letter and cannot end with a hyphen.
-
Optionally, enter a random decription for the runner.
-
Enter the previously obtained GitLab Runner token.
-
Select or create a service account for the runner.
Note
This service account will be used only to create the VM and will not be linked to it. The service account must have the compute.admin, vpc.admin, and iam.serviceAccounts.user roles. For more information, see Assigning roles to a service account.
-
Optionally, add labels to break runners into logical groups.
-
Under Autoscale settings, specify:
- Minimum workers: Number of workers that are always running and ready to execute jobs. Default value:
1; minimum:0; maximum:10. - Maximum workers: Maximum number of workers that can be created to execute jobs. Default value:
3; minimum:1; maximum:30. The maximum number of workers cannot be less than the minimum number. - Maximum worker downtime, in minutes: Maximum idle time after which the additionally created worker will be deleted. Default value:
10; minimum:0. - Maximum number of jobs per worker: Maximum number of jobs after which the worker will be deleted. Default value:
100; minimum:0. - Number of parallel tasks per worker: Number of parallel jobs per worker. Default value:
1; minimum:0.
- Minimum workers: Number of workers that are always running and ready to execute jobs. Default value:
-
Optionally, add labels for the worker.
-
Under Computing resources, select a computing resource configuration.
-
Under Disks and file storages, configure the boot disk:
- Select the disk type.
- Specify the disk size.
-
Optionally, select or create a service account for the worker.
Note
This service account will be associated with the worker VM. The worker can use the account to authenticate in the Yandex Cloud API and access cloud resources.
Assign your service account a role for the resource you want to manage.
-
Optionally, select a security group.
-
Click Create.
Updating a runner
-
Go to Managed Service for GitLab.
-
Select the Managed Service for GitLab instance containing the runner you want to update.
-
Select the Runners tab.
-
Click
next to the runner and select Edit. -
Enter a new name and description for the runner.
-
Select or create a service account for the runner.
Note
This service account will be used only to create the VM and will not be linked to it. The service account must have the compute.admin, vpc.admin, and iam.serviceAccounts.user roles. For more information, see Assigning roles to a service account.
-
Add labels to break runners into logical groups.
-
Change the scaling settings:
- Minimum workers: Number of workers that are always running and ready to execute jobs. Default value:
1; minimum:0; maximum:10. - Maximum workers: Maximum number of workers that can be created to execute jobs. Default value:
3; minimum:1; maximum:30. The maximum number of workers cannot be less than the minimum number. - Maximum worker downtime, in minutes: Maximum idle time after which the additionally created worker will be deleted. Default value:
10; minimum:0. - Maximum number of jobs per worker: Maximum number of jobs after which the worker will be deleted. Default value:
100; minimum:0. - Number of parallel tasks per worker: Number of parallel jobs per worker. Default value:
1; minimum:0.
- Minimum workers: Number of workers that are always running and ready to execute jobs. Default value:
-
Add labels for the worker.
-
Select a new configuration of the worker computing resources.
-
Change the type and size of the boot disk.
-
Select or create a service account for the worker.
Note
This service account will be associated with the worker VM. The worker can use the account to authenticate in the Yandex Cloud API and access cloud resources.
Assign your service account a role for the resource you want to manage.
-
Select the security group.
-
Click Save.
Deleting a runner
- Go to Managed Service for GitLab.
- Select the Managed Service for GitLab instance to delete the runner from.
- Select the Runners tab.
- Click
and select Delete next to the runner you want to delete. - In the window that opens, click Delete.