From c1e318d0c5d2a065cecb9299fc58f889050f4149 Mon Sep 17 00:00:00 2001 From: Matthieu Coudron Date: Tue, 26 Apr 2022 11:43:46 +0200 Subject: [PATCH] services.gitlab-runner: support runner description The description for the runner in the UI is by default sthg like "npm_nixos_d0544ed48909" i.e., the name of the attribute. I wanted to have a more user-friendly description and added a description to the service. Seems like gitlab-runner doesn't like having both fields set: "Cannot use two forms of the same flag: description name" so I used one or the other. --- .../services/continuous-integration/gitlab-runner.nix | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/nixos/modules/services/continuous-integration/gitlab-runner.nix b/nixos/modules/services/continuous-integration/gitlab-runner.nix index dc58c6345239..85ac0fb2a890 100644 --- a/nixos/modules/services/continuous-integration/gitlab-runner.nix +++ b/nixos/modules/services/continuous-integration/gitlab-runner.nix @@ -36,12 +36,12 @@ let # register new services ${concatStringsSep "\n" (mapAttrsToList (name: service: '' - if echo "$NEW_SERVICES" | grep -xq ${name}; then + if echo "$NEW_SERVICES" | grep -xq "${name}"; then bash -c ${escapeShellArg (concatStringsSep " \\\n " ([ "set -a && source ${service.registrationConfigFile} &&" "gitlab-runner register" "--non-interactive" - "--name ${name}" + (if service.description != null then "--description \"${service.description}\"" else "--name '${name}'") "--executor ${service.executor}" "--limit ${toString service.limit}" "--request-concurrency ${toString service.requestConcurrency}" @@ -365,6 +365,13 @@ in with RUNNER_ENV variable set. ''; }; + description = mkOption { + type = types.nullOr types.str; + default = null; + description = '' + Name/description of the runner. + ''; + }; executor = mkOption { type = types.str; default = "docker";