The documentation for installing a gitlab runner can be found here:
https://docs.gitlab.com/runner/install/linux-repository.html

Run this command which will add the repository and run apt-get update

curl -L "https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh" | sudo bash

Install the runner

sudo apt-get install gitlab-runner

The next step is to register the gitlab runner, the documentation for that can be found here:
https://docs.gitlab.com/runner/register/index.html

To register the runner, first you need to create it in Gitlab. To do so, go to a group > Build > Runners. Then Click on the New Group Runner button.

  • Select Linux
  • Add a Tag
  • Add a Description

Then Click on Create Runner at the bottom, it is going to give you a command to run in your instance and crfeate a runner.

gitlab-runner register --url https://gitlab.com --token TOKEN

When you run the above command, It will ask you for the name of the runner, and the executor. For the Executor enter shell.

When creating the .gitlab-ci.yml files remember to add the tags so that the runner runs the pipelines for the project!. Here is an example:

...
  environment:
    name: develop
  tags:
    - SameTagAsRunner
  only:
    - develop

Leave a Reply

Your email address will not be published. Required fields are marked *