2024-04-21 19:38:47 +02:00
|
|
|
{
|
|
|
|
inputs',
|
|
|
|
pkgs,
|
|
|
|
config,
|
|
|
|
...
|
|
|
|
}: {
|
|
|
|
services.hashicorp.vault-agent = {
|
|
|
|
settings.template = let
|
|
|
|
buildbotRestart =
|
|
|
|
pkgs.writeShellScript "buildbot-reload.sh"
|
|
|
|
''
|
|
|
|
sudo systemd-run -P --machine klipper /run/current-system/sw/bin/bash -l -c \
|
|
|
|
'systemctl try-reload-or-restart container@buildbot' || true
|
|
|
|
'';
|
|
|
|
in
|
|
|
|
map (v: v // {command = buildbotRestart;}) [
|
|
|
|
{
|
2024-04-27 22:10:15 +02:00
|
|
|
source = pkgs.writeText "buildbot.github_oauth_secret.vtmpl" ''
|
2024-04-21 19:38:47 +02:00
|
|
|
{{ with secret "kv/data/cluster/buildbot/buildbot" }}{{ .Data.data.oauth_secret }}{{ end }}
|
|
|
|
'';
|
2024-04-27 22:10:15 +02:00
|
|
|
destination = "/run/secrets/buildbot/github_oauth_secret";
|
2024-04-21 19:38:47 +02:00
|
|
|
}
|
|
|
|
{
|
2024-04-27 22:10:15 +02:00
|
|
|
source = pkgs.writeText "buildbot.github_token.vtmpl" ''
|
2024-04-21 19:38:47 +02:00
|
|
|
{{ with secret "kv/data/cluster/buildbot/buildbot" }}{{ .Data.data.token }}{{ end }}
|
|
|
|
'';
|
2024-04-27 22:10:15 +02:00
|
|
|
destination = "/run/secrets/buildbot/github_token";
|
2024-04-21 19:38:47 +02:00
|
|
|
}
|
|
|
|
{
|
2024-04-27 22:10:15 +02:00
|
|
|
source = pkgs.writeText "buildbot.github_webhook_secret.vtmpl" ''
|
2024-04-21 19:38:47 +02:00
|
|
|
{{ with secret "kv/data/cluster/buildbot/buildbot" }}{{ .Data.data.webhook_secret }}{{ end }}
|
|
|
|
'';
|
2024-04-27 22:10:15 +02:00
|
|
|
destination = "/run/secrets/buildbot/github_webhook_secret";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
source = pkgs.writeText "buildbot.gitea_token.vtmpl" ''
|
|
|
|
{{ with secret "kv/data/cluster/buildbot/gitea" }}{{ .Data.data.token }}{{ end }}
|
|
|
|
'';
|
|
|
|
destination = "/run/secrets/buildbot/gitea_token";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
source = pkgs.writeText "buildbot.gitea.oauth_secret.vtmpl" ''
|
|
|
|
{{ with secret "kv/data/cluster/buildbot/gitea" }}{{ .Data.data.oauth_secret }}{{ end }}
|
|
|
|
'';
|
|
|
|
destination = "/run/secrets/buildbot/gitea_oauth_secret";
|
2024-04-21 19:38:47 +02:00
|
|
|
}
|
2024-05-23 20:18:06 +02:00
|
|
|
{
|
|
|
|
source = pkgs.writeText "buildbot.github.app_private_key.vtmpl" ''
|
|
|
|
{{ with secret "kv/data/cluster/buildbot/buildbot" }}{{ .Data.data.app_private_key }}{{ end }}
|
|
|
|
'';
|
|
|
|
destination = "/run/secrets/buildbot/github_app_private_key.pem";
|
|
|
|
}
|
2024-07-24 21:31:21 +02:00
|
|
|
{
|
|
|
|
source = pkgs.writeText "buildbot.wordker_secret.vtmpl" ''
|
|
|
|
{{ with secret "kv/data/cluster/buildbot/buildbot" }}{{ .Data.data.worker_secret }}{{ end }}
|
|
|
|
'';
|
|
|
|
destination = "/run/secrets/buildbot/worker_secret";
|
|
|
|
}
|
|
|
|
{
|
|
|
|
source = pkgs.writeText "buildbot.wordkers.json.vtmpl" ''
|
|
|
|
[
|
|
|
|
{ "name": "buildbot", "pass": "{{ with secret "kv/data/cluster/buildbot/buildbot" }}{{ .Data.data.worker_secret }}{{ end }}", "cores": 24 }
|
|
|
|
]
|
|
|
|
'';
|
|
|
|
destination = "/run/secrets/buildbot/workers.json";
|
|
|
|
}
|
2024-04-21 19:38:47 +02:00
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
containers.buildbot = {
|
|
|
|
ephemeral = true;
|
|
|
|
autoStart = true;
|
|
|
|
privateNetwork = false;
|
|
|
|
|
|
|
|
bindMounts = {
|
|
|
|
"/var/lib/buildbot" = {
|
|
|
|
hostPath = "/mnt/kyle/infrastructure/buildbot/data";
|
|
|
|
isReadOnly = false;
|
|
|
|
};
|
|
|
|
"/var/lib/postgresql" = {
|
|
|
|
hostPath = "/mnt/kyle/infrastructure/buildbot/database";
|
|
|
|
isReadOnly = false;
|
|
|
|
};
|
|
|
|
"/secret" = {
|
|
|
|
hostPath = "/run/secrets/buildbot";
|
|
|
|
isReadOnly = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
specialArgs = {
|
|
|
|
inherit inputs';
|
|
|
|
};
|
|
|
|
|
2024-07-15 19:31:54 +02:00
|
|
|
nixpkgs = inputs'.buildbot-nix.inputs.nixpkgs;
|
|
|
|
|
2024-04-21 19:38:47 +02:00
|
|
|
config = {
|
|
|
|
boot.isContainer = true;
|
|
|
|
|
|
|
|
nix.settings = config.nix.settings;
|
|
|
|
nix.package = config.nix.package;
|
|
|
|
|
|
|
|
imports = [
|
|
|
|
../buildbot-container/buildbot.nix
|
|
|
|
];
|
|
|
|
|
|
|
|
networking.hostName = "buildbot";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|