Skip to content

Commit

Permalink
nixos/github-runner: use hostname as default for option name
Browse files Browse the repository at this point in the history
Until now, the runner registration did not set the `--name` argument if
the configuration option was `null`, the default for the option.
According to GitHub's documentation, this instructs the registration
script to use the machine's hostname.

This commit causes the registration to always pass the `--name` argument
to the runner configuration script. The option now defaults to
`networking.hostName` which should be always set on NixOS.

This change becomes necessary as the systemd service name includes the
name of the runner since fcfa809 and, hence, expects it to be set. Thus,
an unset `name` option leads to an error.
  • Loading branch information
veehaitch committed Mar 28, 2021
1 parent fcfa809 commit 9dcd2ec
Showing 1 changed file with 3 additions and 3 deletions.
Expand Up @@ -46,14 +46,14 @@ in
};

name = mkOption {
type = types.nullOr types.str;
type = types.strMatching "^$|^[[:alnum:]]([[:alnum:]_-]{0,61}[[:alnum:]])?$";
description = ''
Name of the runner to configure. Defaults to the hostname.
Changing this option triggers a new runner registration.
'';
example = "nixos";
default = null;
default = config.networking.hostName;
};

runnerGroup = mkOption {
Expand Down Expand Up @@ -200,7 +200,7 @@ in
--url '${cfg.url}' \
--token "$token" \
--labels '${concatStringsSep "," cfg.extraLabels}' \
${optionalString (cfg.name != null) "--name '${cfg.name}'"} \
--name '${cfg.name}' \
${optionalString cfg.replace "--replace"} \
${optionalString (cfg.runnerGroup != null) "--runnergroup '${cfg.runnerGroup}'"}
Expand Down

0 comments on commit 9dcd2ec

Please sign in to comment.