Gitlab Runner: Finally use your Raspberry Pi

You got a Raspberry PI at home, but you don´t know what to do with it? With some very simple steps, you can turn it into a Gitlab Runner:

Install Gitlab Runner

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

Get Gitlab Runner Token

  • Open your project on gitlab.com.
  • Go to Settings > CI/CD > Runners.
  • Search for “Set up a specific Runner manually”.
  • Copy the Registration Token.

Start Runner on your Raspberry Pi

The only thing you need to change is “YOUR-TOKEN”, that would be the Registration Token you just copied:

sudo gitlab-runner register -n \
    --url https://gitlab.com/ \
    --registration-token YOUR-TOKEN \
    --executor docker \
    --description "Fancy Runner" \
    --docker-image "docker:stable" \
    --docker-privileged

See it in action

You should now see the Runner right where you copied the Registration Token:

When you start a new pipeline build, your new Runner will pick it up:

Keep your Gitlab Runner up to date

Once in a while, you may want to update your Runner, which is pretty easy:

sudo apt-get update
sudo apt-get upgrade

What else?

  • Gitlab Runner commands
  • The Runner will work even after rebooting your Raspberry Pi.
  • Docker has to be installed to make this work.
  • Use “docker stats” to see the Runner stats while he is busy.
  • The Runner is locked to a specific project by default, but you can change the settings directly on Gitlab and enable it for other Projects too.
  • The enabled Runner will be used first, Shared Runners will only join if there is more than one job in parallel. You can also disable Shared Runners though.
  • I suggest using a Raspberry Pi 3 (or newer).
  • It will be a lot slower than Gitlabs free Shared Runners (with 2000 free build minutes). The same scenario took 10min on a Raspberry Pi 3 instead of 2-3min (Shared Runner). But it´s still fun to have your own Runner on a Raspberry Pi!
  • If you need a more powerful Runner (maybe with several concurrent builds and stuff), you can use the exact same commands to install it on any Debian/Ubuntu/Mint machine!
  • You may need to increase the Swapfile if you get any errors.

Leave a Comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.