Introduction

GitLab Runner is an application that works with GitLab CI/CD to run jobs in a pipeline.

Prerequisites

Instructions

This section describes how to install and configure GitLab runner using docker on some server.

  1. Deploy virtual server in Portal

    Skip this step if you already have a server. 

    If you need new server, you can deploy one via TDS portal - Orchestration - Servers#Howtodeploynewserver


  2. Install Docker engine on server – choose one of the following options
  3. Add your user to docker group to be able to run docker commands (more about security in article)

    sudo usermod -aG docker $USER


  4. Start docker container with latest version of gitlab runner (official instructions)

    docker run -d --name gitlab-runner --restart always -v /srv/gitlab-runner/config:/etc/gitlab-runner -v /var/run/docker.sock:/var/run/docker.sock gitlab/gitlab-runner:latest


  5. Configure GitLab runner to connect to your repository
    1. Go to desired GitLab repository → Settings → CI/CD → Runners
    2. Go to "Set up a specific runner for a project" section
      • Copy the "URL" and "registration token", you will need it in next steps
    3. Execute following command on the server with running docker container

      docker exec -it gitlab-runner gitlab-runner register --docker-privileged


    4. You will be prompted to fill-in following parameters:
      • URL from step 5.b.
      • Token from step 5.b.
      • Description
      • Tags for the runner (can leave this blank for the moment).
      • Specify docker executor
      • Specify a default Docker image (e.g. alpine:latest)