modules(drone-exec-runner): protect runners from killing themselves

This commit is contained in:
Raito Bezarius 2021-07-26 03:07:00 +02:00
parent 1fbe57be14
commit 2362a3f38e

View file

@ -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;