Published on: November 19, 2024
3 min read
This tutorial will teach you how to set up a new group runner on GitLab.com using Google Cloud Platform in less than 10 minutes.
Are you interested in hosting your own servers to run your GitLab CI/CD pipelines but don’t know where to begin? Setting up a GitLab Runner to run your pipelines on your own infrastructure can seem like a daunting task as it requires infrastructure knowledge and the know-how to maintain that infrastructure. Typically this process requires the provision of infrastructure, the installing of dependency, and testing that it works with your GitLab instance.
This article highlights how easy it is to easily spin up a GitLab Runner of your own utilizing GitLab’s Google Cloud Integration. Follow this tutorial and it will teach you how to set up a new group runner on GitLab.com using Google Cloud Platform in less than 10 minutes!
You will learn how to:
gcloud cli
and Terraform.Note: Navigate to the group level.
6. Once this information is filled out, click Setup instructions.
Run the bash script provided in Step 1 above.
Note: This script was saved to a file called setup.sh
for ease of use. You may copy this right into your terminal if you are confident in debugging.
7. Create a main.tf
file and follow the instructions in GitLab.
Note: If you want to use OpenTofu instead of Terraform, you can still copy the code and only have to adjust the Terraform commands for applying the configuration.
Once successfully provisioned, you should be see the following:
8. If you close the instructions and click the View runners button, you will now have a newly provisioned runner present with "Never contacted" as its status.
9. In any project, add the following .gitlab-ci.yml
.
stages:
- greet
hello_job:
stage: greet
tags:
- gcp-runner
script:
- echo "hello"
Volia! You have set up your first GitLab Runner utilizing Google Cloud Platform.
Now that you have provisioned your very own GitLab Runner, consider optimizing it for your specific use case. Some things to consider with your runner moving forward:
Make sure to bookmark the Provisioning runners in Google Cloud documentation for easy reference.