diff options
author | Pascal Bach <pasci.bach@gmail.com> | 2017-07-11 16:38:46 +0200 |
---|---|---|
committer | zimbatm <zimbatm@zimbatm.com> | 2017-07-11 15:38:46 +0100 |
commit | c725924dfd2c686f269b4a7668f52e11a92f2e46 (patch) | |
tree | 4bc360bfaad897373e9318ac0bbb0b5e2da311e9 /nixos/modules/services/continuous-integration/gitlab-runner.nix | |
parent | 469aeb9a7feaf474ca340d905640c6bbf759bf0d (diff) | |
download | nixpkgs-c725924dfd2c686f269b4a7668f52e11a92f2e46.tar nixpkgs-c725924dfd2c686f269b4a7668f52e11a92f2e46.tar.gz nixpkgs-c725924dfd2c686f269b4a7668f52e11a92f2e46.tar.bz2 nixpkgs-c725924dfd2c686f269b4a7668f52e11a92f2e46.tar.lz nixpkgs-c725924dfd2c686f269b4a7668f52e11a92f2e46.tar.xz nixpkgs-c725924dfd2c686f269b4a7668f52e11a92f2e46.tar.zst nixpkgs-c725924dfd2c686f269b4a7668f52e11a92f2e46.zip |
gitlab-runner service: support graceful termination (#27222)
The current behavior was for gitlab-runner is to immediately terminate when there was a restart required. This can lead to aborted builds and is annoying to users. By enabling graceful mode gitlab-runner will wait for all builds to finish before terminating. The disadvantage is that a nixos-rebuild switch needs to wait till all jobs are done. Because of that it is not enabled by default.
Diffstat (limited to 'nixos/modules/services/continuous-integration/gitlab-runner.nix')
-rw-r--r-- | nixos/modules/services/continuous-integration/gitlab-runner.nix | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/nixos/modules/services/continuous-integration/gitlab-runner.nix b/nixos/modules/services/continuous-integration/gitlab-runner.nix index 048343b3360..b11bc031b3f 100644 --- a/nixos/modules/services/continuous-integration/gitlab-runner.nix +++ b/nixos/modules/services/continuous-integration/gitlab-runner.nix @@ -15,6 +15,23 @@ in description = "Verbatim config.toml to use"; }; + gracefulTermination = mkOption { + default = false; + type = types.bool; + description = '' + Finish all remaining jobs before stopping, restarting or reconfiguring. + If not set gitlab-runner will stop immediatly without waiting for jobs to finish, + which will lead to failed builds. + ''; + }; + + gracefulTimeout = mkOption { + default = "infinity"; + type = types.str; + example = "5min 20s"; + description = ''Time to wait until a graceful shutdown is turned into a forceful one.''; + }; + workDir = mkOption { default = "/var/lib/gitlab-runner"; type = types.path; @@ -45,6 +62,11 @@ in --service gitlab-runner \ --user gitlab-runner \ ''; + + } // optionalAttrs (cfg.gracefulTermination) { + TimeoutStopSec = "${cfg.gracefulTimeout}"; + KillSignal = "SIGQUIT"; + KillMode = "process"; }; }; |