Sobes.tech
Junior

What does the runner pipeline in GitLab CI run on?

sobes.tech AI

Answer from AI

GitLab Runner is an agent that executes your pipeline jobs. Runners can be run on various platforms:

  • Virtual machine or physical server: A traditional method that allows full control over the environment.
  • Containers (Docker): Enables running each job in an isolated, standard environment. This is the most popular method.
  • Kubernetes: GitLab Runner has an executor for Kubernetes that runs each job in a separate pod.
  • Cloud providers: Some cloud providers offer services for running containers or virtual machines that can be used as Runners.
  • macOS / Windows: Runners can be run on these operating systems for building specific projects.

When configuring a runner, an "executor" is specified, which determines how the jobs will be executed. The most common are: docker, shell, kubernetes.

Example of defining a runner in the .gitlab-ci.yml file using the docker executor:

stages:
  - build

build_job:
  stage: build
  script:
    - echo "Building project..."

In this example, the build_job will be executed on a runner that has a configured docker executor. GitLab Runner will receive this job and run it in a new Docker container, using the Docker image specified in the runner's configuration or in the .gitlab-ci.yml itself (if image is specified).