Deploying a custom CI runner for Salsa using nspawn-runner

0. First, register a runner.

1. On the host, install nspawn-runner executable to /usr/local/bin/nspawn-runner.

2. Get the output of nspawn-runner toml, and replace the [[runners]] section of /etc/gitlab-runner/config.toml. Set the correct "name", "url", "token" as they were set in step 0.

3. Create an image named "unstable": nspawn-runner chroot-create unstable This will default to an unstable chroot.

4. Copy filter-output, add_extra_repository.sh from Salsa CI Team repo to /var/lib/nspawn-runner/unstable/usr/local/bin/

5. If apt-cacher-ng is available on the host, drop /etc/apt/apt.conf.d/000apt-cacher-ng-proxy to /var/lib/nspawn-runner/unstable/etc/apt/apt.conf.d/.

6. nspawn-runner chroot-login unstable then apt install gitlab-runner eatmydata

You're good to go.

Hint: tag the runner in gitlab's ci/cd settings, and tag the ci jobs accordingly, to avoid accidentally running other jobs in your dedicated runner.


CategoryDebianDevelopment