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.
This commit is contained in:
Matthieu Coudron 2022-04-26 11:43:46 +02:00
parent 87d34a6b89
commit c1e318d0c5

View File

@ -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 <literal>RUNNER_ENV</literal> variable set.
'';
};
description = mkOption {
type = types.nullOr types.str;
default = null;
description = ''
Name/description of the runner.
'';
};
executor = mkOption {
type = types.str;
default = "docker";