Welcome to this friendly and informative guide on installing GitLab CI runners! If you're ready to boost your CI/CD pipelines with high-performance managed runners, you're in the right place. We'll walk you through each step to get your runners up and running smoothly.
First, let's understand why GitLab CI runners are so essential. Runners are lightweight agents that execute your CI/CD jobs. While GitLab offers shared runners for public projects, using self-managed runners gives you control and customization for private projects. Here are some benefits:
Before we dive into the installation process, make sure you have the following:
Head over to your GitLab repository settings and navigate to CI/CD, then expand the Runners section. Here, you can create a new runner. Assign tags to your runner to streamline it for specific jobs.
On your runner machine, open the terminal with sudo permissions. Enter the registration URL and run the command gitlab-runner run
. This will allow you to monitor the live status of the jobs assigned to and executed by the runner.
You can tweak the runner settings by modifying the /etc/gitlab-runner/config.toml
file according to your requirements. Here's a basic example:
tomlCopier le code
[[runners]]
name = "My Self-Managed Runner"
url = "https://gitlab.com/"
token = "your_registration_token"
executor = "docker"
[runners.custom_build_dir]
[runners.docker]
tls_verify = false
image = "alpine:latest"
privileged = true
Finally, start your runner using the following commands:
bashCopier le code
sudo gitlab-runner start
sudo gitlab-runner run
Don't forget to restart the runner with sudo gitlab-runner restart
if you make any changes to the config.toml
file.
An essential part of this process is the .gitlab-ci.yml
file. Pipelines get initiated every time this file is created, modified, committed, or pushed to the repo. Make sure the file name matches exactly as .gitlab-ci.yml
to avoid any issues.
Create the file with the same tag or tags assigned to the runner to ensure the correct runner(s) handle the job/pipeline. Here's a simple example:
yamlCopier le code
stages:
- print-something
user-deletion-prevention-check-job:
stage: print-something
script:
- echo "Printing something....."
tags:
- test-runner
If your looking for a managed gitlab runner, maybe you should look to what we built.
And that's it! You're now set to get started with GitLab self-managed runners.