hydra: wire up new builders
Signed-off-by: Raito Bezarius <masterancpp@gmail.com>
This commit is contained in:
parent
eb21cb6916
commit
a30c1f7d78
|
@ -40,6 +40,11 @@
|
||||||
hydra.enable = true;
|
hydra.enable = true;
|
||||||
hydra.dbi = "dbi:Pg:dbname=hydra;user=hydra";
|
hydra.dbi = "dbi:Pg:dbname=hydra;user=hydra";
|
||||||
|
|
||||||
|
hydra.builders = [
|
||||||
|
"builder-0"
|
||||||
|
"builder-1"
|
||||||
|
];
|
||||||
|
|
||||||
ofborg.enable = true;
|
ofborg.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@ in
|
||||||
|
|
||||||
networking.useNetworkd = true;
|
networking.useNetworkd = true;
|
||||||
networking.hostName = "builder-${toString cfg.num}";
|
networking.hostName = "builder-${toString cfg.num}";
|
||||||
|
networking.domain = "wob01.infra.forkos.org";
|
||||||
|
|
||||||
systemd.network = {
|
systemd.network = {
|
||||||
netdevs = {
|
netdevs = {
|
||||||
|
|
|
@ -1,14 +1,28 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{ nodes, config, lib, pkgs, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.bagel.services.hydra;
|
cfg = config.bagel.services.hydra;
|
||||||
|
ssh-keys = import ../../common/ssh-keys.nix;
|
||||||
|
|
||||||
narCacheDir = "/var/cache/hydra/nar-cache";
|
narCacheDir = "/var/cache/hydra/nar-cache";
|
||||||
port = 3000;
|
port = 3000;
|
||||||
|
|
||||||
mkCacheSettings = settings: builtins.concatStringsSep "&" (
|
mkCacheSettings = settings: builtins.concatStringsSep "&" (
|
||||||
lib.mapAttrsToList (k: v: "${k}=${v}") settings
|
lib.mapAttrsToList (k: v: "${k}=${v}") settings
|
||||||
);
|
);
|
||||||
|
|
||||||
|
mkBaremetalBuilder = { nrCores, publicHostKey, host, speedFactor ? 1, user ? "builder", supportedSystems ? [ "i686-linux" "x86_64-linux" ], supportedFeatures ? [ "big-parallel" "kvm" "nixos-test" ] }:
|
||||||
|
"ssh://${user}@${host} ${lib.concatStringsSep "," supportedSystems} ${config.age.secrets.hydra-ssh-key-priv.path} ${toString nrCores} ${toString speedFactor} ${lib.concatStringsSep "," supportedFeatures} - ${publicHostKey}";
|
||||||
|
|
||||||
|
# TODO:
|
||||||
|
# - generalize to new architectures
|
||||||
|
# - generalize to new features
|
||||||
|
baremetalBuilders = lib.concatStringsSep "\n"
|
||||||
|
(map (n: mkBaremetalBuilder {
|
||||||
|
nrCores = 40; # TODO: do not hardcode this, use the node's builder configuration.
|
||||||
|
publicHostKey = ssh-keys.machines.${n};
|
||||||
|
host = nodes.${n}.config.networking.fqdn;
|
||||||
|
}) cfg.builders);
|
||||||
in {
|
in {
|
||||||
options.bagel.services.hydra = with lib; {
|
options.bagel.services.hydra = with lib; {
|
||||||
enable = mkEnableOption "Hydra coordinator";
|
enable = mkEnableOption "Hydra coordinator";
|
||||||
|
@ -17,9 +31,19 @@ in {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
description = "DBI connection string for the Hydra postgres database";
|
description = "DBI connection string for the Hydra postgres database";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
builders = mkOption {
|
||||||
|
type = types.listOf types.str;
|
||||||
|
description = "List of builders to configure for Hydra";
|
||||||
|
example = [ "builder-0" "builder-1" ];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
|
# TODO: we should assert or warn that the builders
|
||||||
|
# does indeed have our public SSH key and are *builders*
|
||||||
|
# as a simple evaluation preflight check.
|
||||||
|
|
||||||
age.secrets.hydra-s3-credentials.file = ../../secrets/hydra-s3-credentials.age;
|
age.secrets.hydra-s3-credentials.file = ../../secrets/hydra-s3-credentials.age;
|
||||||
|
|
||||||
age.secrets.hydra-ssh-key-priv.owner = "hydra-queue-runner";
|
age.secrets.hydra-ssh-key-priv.owner = "hydra-queue-runner";
|
||||||
|
@ -54,7 +78,8 @@ in {
|
||||||
buildMachinesFiles = [
|
buildMachinesFiles = [
|
||||||
(pkgs.writeText "hydra-builders.conf" ''
|
(pkgs.writeText "hydra-builders.conf" ''
|
||||||
ssh://bagel-builder@epyc.infra.newtype.fr i686-linux,x86_64-linux ${config.age.secrets.hydra-ssh-key-priv.path} 8 1 big-parallel,kvm,nixos-test - c3NoLWVkMjU1MTkgQUFBQUMzTnphQzFsWkRJMU5URTVBQUFBSU9YVDlJbml0MU1oS3Q0cmpCQU5McTB0MGJQd3cvV1FaOTZ1QjRBRURybWwgcm9vdEBuaXhvcwo=
|
ssh://bagel-builder@epyc.infra.newtype.fr i686-linux,x86_64-linux ${config.age.secrets.hydra-ssh-key-priv.path} 8 1 big-parallel,kvm,nixos-test - c3NoLWVkMjU1MTkgQUFBQUMzTnphQzFsWkRJMU5URTVBQUFBSU9YVDlJbml0MU1oS3Q0cmpCQU5McTB0MGJQd3cvV1FaOTZ1QjRBRURybWwgcm9vdEBuaXhvcwo=
|
||||||
'')
|
${baremetalBuilders}
|
||||||
|
'')
|
||||||
];
|
];
|
||||||
|
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
|
|
Loading…
Reference in a new issue