Day 5: Understanding GitLab Runners

GitLab Runner is the open-source project that is used to run your jobs and send the results back to GitLab. It is used in conjunction with GitLab CI/CD, the open-source continuous integration service included with GitLab. In other words, GitLab Runner is the workhorse that handles the execution of your CI/CD jobs as defined in your .gitlab-ci.yml file.

A Runner can be a virtual machine, a VPS, a bare-metal machine, a docker container or even a cluster of containers. You can choose different runners based on your requirements such as how much processing power or memory you need, or what type of system your code needs to run on.

Types of Runners

There are three types of runners in GitLab:

  1. Shared Runners: These runners are available to all projects in a GitLab instance and are managed by the instance administrators. They're ideal for jobs that have similar requirements across multiple projects.

  2. Group Runners: These runners are available to all projects in a specific group. They're useful when you have a group of projects that have similar runner requirements.

  3. Specific Runners: These runners are associated with specific projects. They're great for jobs that have unique requirements, or for sensitive jobs that should only be run on runners that you control.

Registering a GitLab Runner

You can register a runner by following these steps:

  1. Install GitLab Runner on the machine you want to use. You can find instructions for different operating systems in the GitLab Runner Install documentation.

  2. Obtain the registration token for your project or group. You can find it in the Settings > CI/CD page of your project or group.

  3. Register the runner using the gitlab-runner register command. The command will prompt you for the GitLab instance URL, the registration token, and other information.

After you've registered the runner, it will automatically pick up jobs from your GitLab CI/CD pipelines and run them.

That's all for today! You've learned about GitLab Runners, the engine that powers GitLab CI/CD. In the next session, we will dig deeper into how to configure jobs to use specific runners, and how to set up runner caches to speed up your pipelines. See you tomorrow!