Commit 2af041ab authored by Stefan Frijters's avatar Stefan Frijters Committed by Matthieu Coudron
Browse files

nixos/gitlab-runner: do not pull in Docker if gitlab-runner-clear-docker-cache is disabled

Only create the service if the option is enabled and if any docker executors exist.
parent 84e04bd3
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -577,7 +577,7 @@ in {
      };
    };
    # Enable periodic clear-docker-cache script
    systemd.services.gitlab-runner-clear-docker-cache = {
    systemd.services.gitlab-runner-clear-docker-cache = mkIf (cfg.clear-docker-cache.enable && (any (s: s.executor == "docker") (attrValues cfg.services))) {
      description = "Prune gitlab-runner docker resources";
      restartIfChanged = false;
      unitConfig.X-StopOnRemoval = false;
@@ -590,7 +590,7 @@ in {
        ${pkgs.gitlab-runner}/bin/clear-docker-cache ${toString cfg.clear-docker-cache.flags}
      '';

      startAt = optional cfg.clear-docker-cache.enable cfg.clear-docker-cache.dates;
      startAt = cfg.clear-docker-cache.dates;
    };
    # Enable docker if `docker` executor is used in any service
    virtualisation.docker.enable = mkIf (