nixos/gitlab-runner: fix problems introduced by last #209716

This commit is contained in:
Maciej Pasternacki 2023-01-08 17:00:51 +01:00
parent 194b1690e7
commit d5cb89b024

View File

@ -9,14 +9,14 @@ let
The hash is recorded in the runner's name because we can't do better yet The hash is recorded in the runner's name because we can't do better yet
See https://gitlab.com/gitlab-org/gitlab-runner/-/issues/29350 for more details See https://gitlab.com/gitlab-org/gitlab-runner/-/issues/29350 for more details
*/ */
genRunnerName = service: let genRunnerName = name: service: let
hash = substring 0 12 (hashString "md5" (unsafeDiscardStringContext (toJSON service))); hash = substring 0 12 (hashString "md5" (unsafeDiscardStringContext (toJSON service)));
in if service ? description in if service ? description && service.description != null
then "${hash} ${service.description}" then "${hash} ${service.description}"
else "${name}_${config.networking.hostName}_${hash}"; else "${name}_${config.networking.hostName}_${hash}";
hashedServices = mapAttrs' hashedServices = mapAttrs'
(name: service: nameValuePair (genRunnerName service) service) cfg.services; (name: service: nameValuePair (genRunnerName name service) service) cfg.services;
configPath = ''"$HOME"/.gitlab-runner/config.toml''; configPath = ''"$HOME"/.gitlab-runner/config.toml'';
configureScript = pkgs.writeShellApplication { configureScript = pkgs.writeShellApplication {
name = "gitlab-runner-configure"; name = "gitlab-runner-configure";
@ -38,7 +38,7 @@ let
'' else '' '' else ''
export CONFIG_FILE=${configPath} export CONFIG_FILE=${configPath}
mkdir -p "$(dirname "${configPath}")" mkdir -p "$(dirname ${configPath})"
touch ${configPath} touch ${configPath}
# update global options # update global options