Merge pull request #322403 from dadada/dev/gitlab-runner-podman

nixos/gitlab-runner: allow access to podman socket
This commit is contained in:
Sandro 2024-08-03 16:48:09 +02:00 committed by GitHub
commit cfd25f7c6a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -40,6 +40,7 @@ let
cfg = config.services.gitlab-runner;
hasDocker = config.virtualisation.docker.enable;
hasPodman = config.virtualisation.podman.enable && config.virtualisation.podman.dockerSocket.enable;
/* The whole logic of this module is to diff the hashes of the desired vs existing runners
The hash is recorded in the runner's name because we can't do better yet
@ -702,8 +703,11 @@ in {
description = "Gitlab Runner";
documentation = [ "https://docs.gitlab.com/runner/" ];
after = [ "network.target" ]
++ optional hasDocker "docker.service";
requires = optional hasDocker "docker.service";
++ optional hasDocker "docker.service"
++ optional hasPodman "podman.service";
requires = optional hasDocker "docker.service"
++ optional hasPodman "podman.service";
wantedBy = [ "multi-user.target" ];
environment = config.networking.proxy.envVars // {
HOME = "/var/lib/gitlab-runner";
@ -729,7 +733,8 @@ in {
# Make sure to restart service or changes won't apply.
DynamicUser = true;
StateDirectory = "gitlab-runner";
SupplementaryGroups = optional hasDocker "docker";
SupplementaryGroups = optional hasDocker "docker"
++ optional hasPodman "podman";
ExecStartPre = "!${configureScript}/bin/gitlab-runner-configure";
ExecStart = "${startScript}/bin/gitlab-runner-start";
ExecReload = "!${configureScript}/bin/gitlab-runner-configure";