Provision runners in Google Cloud Compute Engine
-
Introduced in GitLab 16.10 with a flag named
google_cloud_support_feature_flag
. This feature is in beta. -
Enabled on GitLab.com in GitLab 17.1. Feature flag
google_cloud_support_feature_flag
removed.
You can create a project or group runner for GitLab.com and provision it on your Google Cloud project. When you create a runner, the GitLab UI provides on-screen instructions and scripts to automatically provision the runner in your Google Cloud project.
A runner authentication token is assigned to your runner when you create it. A GRIT Terraform script uses this token to register the runner. The runner then uses the token to authenticate with GitLab when it picks up jobs from the job queue.
After provisioning, an autoscaling fleet of runners is ready to run CI/CD jobs in Google Cloud. The runner manager creates temporary runners automatically.
Prerequisites:
- For group runners: Owner role for the group.
- For project runners: Maintainer role for the project.
- For your Google Cloud Platform project: Owner IAM role.
- Billing enabled for your Google Cloud Platform project.
- A working
gcloud
CLI tool authenticated with the IAM role on the Google Cloud project. - Terraform v1.5 or later and Terraform CLI tool.
- A terminal with Bash installed.
To create a group or project runner and provision it on Google Cloud:
- On the left sidebar, select Search or go to and find your group.
- Create a new runner.
- To create a new group runner, select Build > Runners > New group runner.
- To create a new project runner, select Settings > CI/CD > Runners > New project runner.
- In the Tags section, in the Tags field, enter the job tags to specify jobs the runner can run. To use the runner for jobs without tags in addition to the tagged jobs, select Run untagged.
- Optional. In the Configuration section, add runner description and additional configurations.
- Select Create runner.
- In the Platform section, select Google Cloud.
-
In Environment, enter the following details of the Google Cloud environment:
- Google Cloud project ID
- Region
- Zone
- Machine type
-
In Set up GitLab Runner, select Setup instructions. In the dialog:
- To enable the required services, service account, and permissions, in Configure Google Cloud project run the Bash script once for each Google Cloud project.
- Create a
main.tf
file with the configuration from Install and register GitLab Runner. The script uses the GitLab Runner Infrastructure Toolkit (GRIT) to provision the infrastructure on the Google Cloud project to execute your runner manager.
After you execute the scripts, a runner manager connects with the runner authentication token. The runner manager might take up to one minute to show as online and start receiving jobs.