Skip to main content

Runner

A GitLab Runner is a fundamental part of GitLab's CI/CD (Continuous Integration and Continuous Delivery) system. It functions as an entity that is responsible for executing specific jobs defined in the files .gitlab-ci.yml. Runners allow the automation of tasks, tests and deployments in a development environment, all managed through GitLab. Here are some of its main features:

  1. Job Execution: Runners execute the jobs defined in the files .gitlab-ci.yml. These jobs may include tasks such as code building, unit testing, static code analysis and deployments.
  2. Multi-platform: Runners are versatile and can run on a variety of operating systems and architectures, allowing compatibility with different types of projects and environments.
  3. Scalability: You can configure multiple Runners for a single project or even for multiple projects, allowing you to scale and distribute the workload as needed.
  4. Docker and Containers: GitLab Runners are compatible with Docker, making it easy to create test environments and deploy applications in containers.
  5. Security: GitLab offers advanced security options for Runners, including secure authentication and authorization to ensure that only authorized users can run jobs in Runners.
  6. Parallelism: Runners can run jobs in parallel, which speeds up the CI/CD process by distributing tasks across multiple Runners if necessary.
  7. Customization: Runners can be configured and customized to meet the specific needs of your project, allowing you to define custom environments, environment variables and execution requirements.
  8. Monitoring and Logging: GitLab provides monitoring and logging tools so you can track the status and performance of your Runners, making it easy to detect and fix problems.
  9. Complex Deployment Scenarios: Runners enable the automation of complex CI/CD workflows that span multiple stages, from build to test and deployment in different environments.

Installation

To proceed with the installation of the Gitlab runner on our platform as with other tools we first need to check the yaml values in the following repo https://gitlab.com/gitlab-org/charts/gitlab-runner/blob/main/values.yaml, so we can see the values we want to use in our deployment.

Then we proceed to create our own or copy the previous one.

We must add to the yaml the token we get from gitlab to register the runner in our cluster

runnerRegistrationToken: "glrt-FQX6FNEB6_vNUQkxnQFt"

We also proceed to add the following settings in order to have the cache and docker in docker enabled

config: |
[[runners]]
[runners.kubernetes]
namespace = "namespace del gitlab-runner"
image = "ubuntu:latest"
[[runners.kubernetes.volumes.host_path]]
name = "docker-socket"
mount_path = "/var/run/docker.sock"
read_only = false
host_path = "/var/run/docker.sock"
[runners.cache]
Type = "s3"
Shared = true
[runners.cache.s3]
ServerAddress = "S3_ADDRESS"
AccessKey = "ACCESSKEY"
SecretKey = "SECRETKEY"
BucketName = "BUCKETNAME"
BucketLocation = "BUCKET_LOCATION"
Insecure = false

Now we add the helm repo

helm repo add gitlab https://charts.gitlab.io

and then proceed to install with the helm

Helm

helm upgrade --install -n  gitlab-runner gitlab-runner -f values.yaml gitlab/gitlab-runner --create-namespace