modules(drone-exec-runner): protect runners from killing themselves
This commit is contained in:
parent
1fbe57be14
commit
2362a3f38e
1 changed files with 12 additions and 0 deletions
|
@ -6,6 +6,16 @@ let
|
||||||
runnerOpts = {
|
runnerOpts = {
|
||||||
options = {
|
options = {
|
||||||
enable = mkEnableOption "Enable an Drone CI/CD Exec Runner";
|
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 {
|
package = mkOption {
|
||||||
type = package;
|
type = package;
|
||||||
default = pkgs.drone-runner-exec;
|
default = pkgs.drone-runner-exec;
|
||||||
|
@ -54,6 +64,8 @@ in
|
||||||
systemd.services = mapAttrs' (runnerName: cfg: nameValuePair ("drone-exec-runner-${runnerName}") ({
|
systemd.services = mapAttrs' (runnerName: cfg: nameValuePair ("drone-exec-runner-${runnerName}") ({
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
|
||||||
|
inherit restartIfChanged;
|
||||||
|
|
||||||
confinement.enable = true;
|
confinement.enable = true;
|
||||||
confinement.packages = cfg.allowedPackages;
|
confinement.packages = cfg.allowedPackages;
|
||||||
path = cfg.allowedPackages;
|
path = cfg.allowedPackages;
|
||||||
|
|
Loading…
Reference in a new issue