gh runner cleanup

This commit is contained in:
Hunter Halloran
2025-12-17 11:20:40 -05:00
parent e7cdc324f8
commit 35cbfceb81
2 changed files with 10 additions and 4 deletions

View File

@@ -19,7 +19,7 @@ mkIf builderCfg.githubRunner.enable {
extraLabels = builderCfg.githubRunner.extraLabels;
user = builderCfg.githubRunner.user;
workDir = builderCfg.githubRunner.workDir;
replace = true;
replace = builderCfg.githubRunner.replace;
};
# Configure the systemd service for better handling of cleanup and restarts
@@ -85,7 +85,7 @@ mkIf builderCfg.githubRunner.enable {
cd "$runnerDir"
# Configure if not already configured or if --replace is set
# Configure the runner, optionally replacing existing registration
if [ ! -f ".runner" ] || [ "${if builderCfg.githubRunner.replace then "true" else "false"}" = "true" ]; then
echo "Configuring GitHub Actions runner..."
${runnerPkg}/bin/Runner.Listener configure \
@@ -95,9 +95,9 @@ mkIf builderCfg.githubRunner.enable {
--name "$(hostname)" \
--labels "${lib.concatStringsSep "," builderCfg.githubRunner.extraLabels}" \
--work "_work" \
--replace
${if builderCfg.githubRunner.replace then "--replace" else ""}
else
echo "Runner already configured."
echo "Runner already configured, skipping configuration."
fi
'';
in

View File

@@ -120,6 +120,12 @@ in
default = "nixos-systems";
description = "Name of the GitHub runner service";
};
replace = mkOption {
type = types.bool;
default = false;
description = "Replace existing runner registration on start";
};
};
};
};