gh runner cleanup
This commit is contained in:
@@ -19,7 +19,7 @@ mkIf builderCfg.githubRunner.enable {
|
|||||||
extraLabels = builderCfg.githubRunner.extraLabels;
|
extraLabels = builderCfg.githubRunner.extraLabels;
|
||||||
user = builderCfg.githubRunner.user;
|
user = builderCfg.githubRunner.user;
|
||||||
workDir = builderCfg.githubRunner.workDir;
|
workDir = builderCfg.githubRunner.workDir;
|
||||||
replace = true;
|
replace = builderCfg.githubRunner.replace;
|
||||||
};
|
};
|
||||||
|
|
||||||
# Configure the systemd service for better handling of cleanup and restarts
|
# Configure the systemd service for better handling of cleanup and restarts
|
||||||
@@ -85,7 +85,7 @@ mkIf builderCfg.githubRunner.enable {
|
|||||||
|
|
||||||
cd "$runnerDir"
|
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
|
if [ ! -f ".runner" ] || [ "${if builderCfg.githubRunner.replace then "true" else "false"}" = "true" ]; then
|
||||||
echo "Configuring GitHub Actions runner..."
|
echo "Configuring GitHub Actions runner..."
|
||||||
${runnerPkg}/bin/Runner.Listener configure \
|
${runnerPkg}/bin/Runner.Listener configure \
|
||||||
@@ -95,9 +95,9 @@ mkIf builderCfg.githubRunner.enable {
|
|||||||
--name "$(hostname)" \
|
--name "$(hostname)" \
|
||||||
--labels "${lib.concatStringsSep "," builderCfg.githubRunner.extraLabels}" \
|
--labels "${lib.concatStringsSep "," builderCfg.githubRunner.extraLabels}" \
|
||||||
--work "_work" \
|
--work "_work" \
|
||||||
--replace
|
${if builderCfg.githubRunner.replace then "--replace" else ""}
|
||||||
else
|
else
|
||||||
echo "Runner already configured."
|
echo "Runner already configured, skipping configuration."
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
in
|
in
|
||||||
|
|||||||
@@ -120,6 +120,12 @@ in
|
|||||||
default = "nixos-systems";
|
default = "nixos-systems";
|
||||||
description = "Name of the GitHub runner service";
|
description = "Name of the GitHub runner service";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
replace = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
description = "Replace existing runner registration on start";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user