From 2362a3f38ead4c9a79014b86e5e006343cb8972a Mon Sep 17 00:00:00 2001 From: Raito Bezarius Date: Mon, 26 Jul 2021 03:07:00 +0200 Subject: [PATCH] modules(drone-exec-runner): protect runners from killing themselves --- modules/servers/drone-exec-runner.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/modules/servers/drone-exec-runner.nix b/modules/servers/drone-exec-runner.nix index 373b993..3f34b9c 100644 --- a/modules/servers/drone-exec-runner.nix +++ b/modules/servers/drone-exec-runner.nix @@ -6,6 +6,16 @@ let runnerOpts = { options = { enable = mkEnableOption "Enable an Drone CI/CD Exec Runner"; + restartIfChanged = mkOption { + type = bool; + default = true; + description = ''Restart the runner if configuration changes. + Consider the scenario where the runner runs on the same machine where it gets deployed and + this runner is redeploying itself. + If restart if changed is true, the runner gets killed during the process, this is very bad. + To enable these scenarios, restart manually the runners once deployment is done. + ''; + }; package = mkOption { type = package; default = pkgs.drone-runner-exec; @@ -54,6 +64,8 @@ in systemd.services = mapAttrs' (runnerName: cfg: nameValuePair ("drone-exec-runner-${runnerName}") ({ wantedBy = [ "multi-user.target" ]; + inherit restartIfChanged; + confinement.enable = true; confinement.packages = cfg.allowedPackages; path = cfg.allowedPackages;