Gitlab runner Quadlet on Fedora CoreOS

In production I’m deploying Gitlab runners as Quadlets on CoreOS using Terraform, but here is just a short description of how to get it running.

You cannot use .container or .volume service unit with Ignition, so you have to define them as ignition_file. At boot the services will be generated.

Here is an example of the container unit which we can call gitlab-runner.container and place under /etc/containers/systemd/gitlab-runner.container to run it as root. My goal is to have one VM per role, so this VM will only run Gitlab runners, therefore I see no point in separating them in their own user.

[Unit]
Description=Gitlab runner 
Wants=network-online.target
After=network-online.target

[Container]
ContainerName=gitlab-runner
Image=docker.io/gitlab/gitlab-runner
Volume=/root/config.toml:/etc/gitlab-runner/config.toml:Z
Volume=/var/run/podman/podman.sock:/var/run/podman/podman.sock:Z

[Service]
Restart=always

# This section is important to autostart the generated .service unit after boot.
[Install]
WantedBy=multi-user.target

Ensure podman.socket is enabled, this creates the /var/run/podman/podman.sock socket file required to emulate Docker.

Then you can use this config for example.

[[runners]]
  name = "black"
  url = "${url}"
  token = "${token}"
  limit = 4
  executor = "docker"

  [runners.docker]
    host = "unix:///var/run/podman/podman.sock"

See also