Add remote autoscaler daemon endpoint support
This commit is contained in:
parent
95021a4253
commit
679b5c8d07
11 changed files with 291 additions and 22 deletions
|
|
@ -25,6 +25,18 @@ in
|
|||
description = "Autoscaler daemon Unix socket path for Buildbot gate/release steps.";
|
||||
};
|
||||
|
||||
daemonUrl = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
default = null;
|
||||
description = "Optional autoscaler daemon HTTP(S) endpoint URL for remote gate/release calls.";
|
||||
};
|
||||
|
||||
daemonAuthTokenFile = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
default = null;
|
||||
description = "Optional file containing bearer token for authenticated daemon API calls.";
|
||||
};
|
||||
|
||||
defaultSystem = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "x86_64-linux";
|
||||
|
|
@ -131,6 +143,10 @@ in
|
|||
assertion = cfg.builderClusterHost != null;
|
||||
message = "services.buildbot-nix.nix-build-autoscaler.builderClusterHost must be set.";
|
||||
}
|
||||
{
|
||||
assertion = cfg.daemonUrl != null || cfg.daemonSocket != "";
|
||||
message = "services.buildbot-nix.nix-build-autoscaler requires either daemonUrl or daemonSocket.";
|
||||
}
|
||||
];
|
||||
|
||||
services.buildbot-master.pythonPackages = ps: [
|
||||
|
|
@ -149,6 +165,7 @@ in
|
|||
];
|
||||
|
||||
services.buildbot-master.extraImports = ''
|
||||
import pathlib
|
||||
from buildbot_autoscale_ext.configurator import AutoscaleConfigurator
|
||||
from buildbot_autoscale_ext.settings import AutoscaleSettings
|
||||
'';
|
||||
|
|
@ -157,7 +174,14 @@ in
|
|||
''
|
||||
AutoscaleConfigurator(
|
||||
AutoscaleSettings(
|
||||
daemon_socket="${cfg.daemonSocket}",
|
||||
daemon_socket=${if cfg.daemonUrl == null then ''"${cfg.daemonSocket}"'' else "None"},
|
||||
daemon_url=${if cfg.daemonUrl != null then ''"${cfg.daemonUrl}"'' else "None"},
|
||||
daemon_auth_token=${
|
||||
if cfg.daemonAuthTokenFile != null then
|
||||
''pathlib.Path("${cfg.daemonAuthTokenFile}").read_text(encoding="utf-8").strip()''
|
||||
else
|
||||
"None"
|
||||
},
|
||||
default_system="${cfg.defaultSystem}",
|
||||
reserve_timeout_seconds=${toString cfg.reserveTimeoutSeconds},
|
||||
poll_interval_seconds=${toString cfg.pollIntervalSeconds},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue