ci-runner: warn when the host has no nix store gc
This commit is contained in:
parent
c5729b4124
commit
493d2e6c37
2 changed files with 47 additions and 3 deletions
|
|
@ -236,6 +236,17 @@ in
|
|||
}
|
||||
];
|
||||
|
||||
# The runner builds through the host's nix daemon, so its outputs fill the
|
||||
# host's /nix/store. The host's nix settings are not this module's to set;
|
||||
# it only tells the operator when neither collector is configured.
|
||||
warnings = lib.optional (!config.nix.gc.automatic && (config.nix.settings.min-free or 0) == 0) ''
|
||||
services.hyperhive.deploy.ci-runner.enable is on, but this host sets
|
||||
neither nix.gc.automatic nor nix.settings.min-free. CI builds fill
|
||||
/nix/store until the disk is full and every job fails with ENOSPC.
|
||||
Add the GC settings from "Host store maintenance" in
|
||||
docs/4-implementation/scheduler/ci.md to the host's NixOS config.
|
||||
'';
|
||||
|
||||
# The container hangs off the bridge, takes its address from the
|
||||
# gateway's DHCP and resolves through its dnsmasq. The gateway also runs
|
||||
# `hive-tls-ca`, which writes the trust bundle bound in below.
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ let
|
|||
;
|
||||
})
|
||||
hive
|
||||
hiveWith
|
||||
runGroup
|
||||
selfScrapes
|
||||
;
|
||||
|
|
@ -56,7 +57,7 @@ let
|
|||
|
||||
# The runner alone: no hive, no forge, no store, its store identity placed
|
||||
# by hand. `nix` is a label without a scheme.
|
||||
ciAlone = hive {
|
||||
ciAloneOpts = {
|
||||
deploy.hive-controller.enable = false;
|
||||
deploy.ci-runner.enable = true;
|
||||
deploy.ci-runner.labels = [
|
||||
|
|
@ -66,6 +67,13 @@ let
|
|||
deploy.bao.ciRunnerClientCertFile = "/etc/pki/bao-ci-runner.pem";
|
||||
deploy.bao.ciRunnerClientKeyFile = "/etc/pki/bao-ci-runner-key.pem";
|
||||
};
|
||||
ciAlone = hive ciAloneOpts;
|
||||
# `ciAlone` with the host's store collection set, one way each.
|
||||
ciGcTimer = hiveWith [ { nix.gc.automatic = true; } ] ciAloneOpts;
|
||||
ciMinFree = hiveWith [ { nix.settings.min-free = 20 * 1024 * 1024 * 1024; } ] ciAloneOpts;
|
||||
ciOffNoGc = hive { deploy.hive-controller.enable = false; };
|
||||
ciGcWarned =
|
||||
m: lib.any (lib.hasInfix "neither nix.gc.automatic nor nix.settings.min-free") m.warnings;
|
||||
ciNoIdentity = hive {
|
||||
deploy.hive-controller.enable = false;
|
||||
deploy.ci-runner.enable = true;
|
||||
|
|
@ -211,6 +219,17 @@ let
|
|||
in
|
||||
!(lib.any (n: lib.elem n (u.after ++ u.wants ++ u.requires)) storeUnits);
|
||||
}
|
||||
{
|
||||
# The module only warns: the host's nix settings stay the host's. Each
|
||||
# collector alone, and the runner being off, silence the warning.
|
||||
name = "the CI runner warns when the host has neither nix.gc.automatic nor nix.settings.min-free";
|
||||
ok =
|
||||
ciGcWarned ciAlone
|
||||
&& !(ciGcWarned ciGcTimer)
|
||||
&& !(ciGcWarned ciMinFree)
|
||||
&& !(ciGcWarned ciOffNoGc)
|
||||
&& !ciAlone.nix.gc.automatic;
|
||||
}
|
||||
{
|
||||
# Without the identity the token never arrives; the control is the
|
||||
# placed pair above.
|
||||
|
|
|
|||
Loading…
Reference in a new issue