gitlab-runner on a laptop without pain
I have several (private) projects hosted on gitlab.com that use Gitlab CI. Since these are private projects, I prefer to run their CI pipelines on private runners. So I set up gitlab-runner on my Kimsufi server. It works great! Except that…
Except that my Kimsufi server is really slow. So tests that run in 2 to 3 minutes on my laptop sometimes take 20 to 30 minutes to run in CI. Which is not acceptable. I’m therefore running a second instance of gitlab-runner, on my laptop this time. It’s much faster! But…
But my laptop is not always on, nor always online. And I don’t want CI pipelines to fail because I closed my laptop, put it in my backpack, and ran to catch my bus home.
So I found a quick and dirty solution: use systemd to start gitlab-runner every morning and stop it every evening
before I run catch my bus. So in addition to the standard gitlab-runner.service
unit, I now have 4 extra systemd
units:
start-gitlab-runner.service
andstart-gitlab-runner.timer
, that start gitlab-runner every morning (but only on weekdays)stop-gitlab-runner.service
andstop-gitlab-runner.timer
, that stop it every evening (also only on weekdays).
All of these are available in a Gist:
All of these files are installed in /etc/systemd/system
. Once they’re there, a simple sudo systemctl daemon-reload && sudo systemctl enable {start,stop}-gitlab-runner.timer
and it’s done.
I’ve used this for 18 months now and it worked pretty well for me. I don’t need to worry about gitlab-runner anymore: problem solved! 👍
Comments
Join the conversation by sending an email. Your comment will be added here and to the public inbox after moderation.