Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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

...

Prerequisites

  • Your GitLab repository supports CI/CD
    • You can

...

    • enable the feature ON

...

    • via following steps Settings → General → Visibility, project features, permissions CI/CD
  • Server that supports docker (supported platforms)

Instructions

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

  1. Deploy virtual server in Portal

    (skip this section

    Info

    Skip this step if you already have a server

    )See article for instructions

    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
      Step by step (official instructions

       Set up the repository

      • Option A - using "convenience script" from official instructions – recommended only for development and testing purposes

      • Code Block
        languagebash
      $:
      • curl -fsSL https://get.docker.com -o get-docker.sh
        sudo sh get-docker.sh
        sudo systemctl start docker


      • Option B - specific approach for each relevant OS - basically setting up repository and installing Docker Engine - all supported OS instructions can be found at https://docs.docker.com/engine/install
        • CentOS - official instructions

          Code Block
          sudo yum install -y yum-utils
          sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
          sudo yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y


        • Fedora - official instructions

          Code Block
          sudo dnf -y install dnf-plugins-core
          
      $:
        • sudo dnf config-manager
        •  --add-repo https://download.docker.com/linux/fedora/docker-ce.repo

      Install Docker Engine

      Code Block
      languagebash
      $:
        • 
          sudo dnf install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

      Convenience script (official instructions) – recommended only for testing and development purposes

        •  -y


        • Ubuntu - official instructions

          Code Block
          sudo apt-get update
          sudo apt-get install ca-certificates curl gnupg lsb-release -y
          sudo mkdir -m 0755 -p /etc/apt/keyrings
          
      Code Block
      languagebash
        • curl -fsSL https://
      get
        • download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o 
      get-
        • /etc/apt/keyrings/docker.
      sh sudo sh get-docker.sh sudo systemctl start docker
        • gpg
          echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null


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

      Code Block
      languagebash
      $: 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


    • Configure GitLab runner to connect to your repository
      1. In your GitLab repository, go to Settings CI/CD Runners
      2. You will need URL and "registration token from " from "Set up a specific runner for a project" section
      3. Call Execute following command on the server with running docker container

        Code Block
        languagebash
        docker exec -it gitlab-runner gitlab-runner register --docker-privileged


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