about summary refs log tree commit diff
path: root/nixos/modules/services/continuous-integration
diff options
context:
space:
mode:
authorVincent Haupert <mail@vincent-haupert.de>2022-11-10 12:23:42 +0100
committerWinter <winter@winter.cafe>2022-11-10 11:06:04 -0500
commit847774470eba277e341f6770c40b4457e3ddec11 (patch)
tree29a0272488e48a323f96b2e94a4b2b3f16f540ea /nixos/modules/services/continuous-integration
parent4f9fa9172c01ff822036fa98f0e50702b522d382 (diff)
nixos/github-runners: restart service if exit code signals a retryable error
On some occasions, the GitHub runner service encounters errors which are
deemed retryable but result in the runner's termination. To signal a
retryable error, the runner exits with status code 2:

https://github.com/actions/runner/blob/40ed7f8/src/Runner.Common/Constants.cs#L146

To account for that behavior, this commit sets
`RestartForceExitStatus=2` which results in a service restart regardless
of using an ephemeral runner or not.
Diffstat (limited to 'nixos/modules/services/continuous-integration')
-rw-r--r--nixos/modules/services/continuous-integration/github-runner/service.nix3
1 files changed, 3 insertions, 0 deletions
diff --git a/nixos/modules/services/continuous-integration/github-runner/service.nix b/nixos/modules/services/continuous-integration/github-runner/service.nix
index 49195410bb423..cd81631582f91 100644
--- a/nixos/modules/services/continuous-integration/github-runner/service.nix
+++ b/nixos/modules/services/continuous-integration/github-runner/service.nix
@@ -170,6 +170,9 @@ with lib;
     # If running in ephemeral mode, restart the service on-exit (i.e., successful de-registration of the runner)
     # to trigger a fresh registration.
     Restart = if cfg.ephemeral then "on-success" else "no";
+    # If the runner exits with `ReturnCode.RetryableError = 2`, always restart the service:
+    # https://github.com/actions/runner/blob/40ed7f8/src/Runner.Common/Constants.cs#L146
+    RestartForceExitStatus = [ 2 ];
 
     # Contains _diag
     LogsDirectory = [ systemdDir ];