deploy: forward swarm.forge.ci to deploy.ci-runner, say what the forwarded enable needs
swarm.forge.ci.* were per-host options that 4423da48 had already moved to deploy.forgejo.ci.*, so they rename straight to deploy.ci-runner like the forgejo.ci ones; ciRunnerRemoved goes with its last caller.
The forwarded enable now trips deploy.ci-runner's store-identity assertion on a host with no deploy.bao.enable. The assertion names both options and the default, the doc states the requirement, and a module-eval case pins the refusal.
This commit is contained in:
parent
b114c6b165
commit
65505f5235
4 changed files with 79 additions and 45 deletions
|
|
@ -74,8 +74,21 @@ let
|
|||
deploy.bao.ciRunnerClientCertFile = "/etc/pki/bao-ci-runner.pem";
|
||||
deploy.bao.ciRunnerClientKeyFile = "/etc/pki/bao-ci-runner-key.pem";
|
||||
};
|
||||
# The old name alone, with no store identity placed and none defaulted.
|
||||
ciUnderForgeNoIdentity = hive {
|
||||
deploy.hive-controller.enable = false;
|
||||
deploy.forgejo.ci.enable = true;
|
||||
};
|
||||
# The older spelling, under the swarm-level forge options.
|
||||
ciUnderSwarmForge = hive { swarm.forge.ci.enable = true; };
|
||||
ciUnderSwarmForge = hive {
|
||||
swarm.forge.ci.enable = true;
|
||||
swarm.forge.ci.name = "older-runner";
|
||||
swarm.forge.ci.concurrency = 2;
|
||||
swarm.forge.ci.labels = [ "nix:host" ];
|
||||
swarm.forge.ci.package = pkgs.hello;
|
||||
deploy.bao.ciRunnerClientCertFile = "/etc/pki/bao-ci-runner.pem";
|
||||
deploy.bao.ciRunnerClientKeyFile = "/etc/pki/bao-ci-runner-key.pem";
|
||||
};
|
||||
|
||||
runsForge = m: m.services.hyperhive.deploy.forgejo.enable && m.containers ? hive-forge;
|
||||
|
||||
|
|
@ -241,9 +254,30 @@ let
|
|||
&& !(lib.any (a: !a.assertion) ciUnderForge.assertions);
|
||||
}
|
||||
{
|
||||
# A removed option evaluates to an assertion naming the replacement.
|
||||
name = "a CI option under swarm.forge names its replacement under deploy.ci-runner";
|
||||
ok = refusedOver ciUnderSwarmForge "services.hyperhive.deploy.ci-runner.enable instead";
|
||||
# The control is the container: it only exists if `enable` arrived.
|
||||
name = "a CI option under swarm.forge sets the same option under deploy.ci-runner";
|
||||
ok =
|
||||
let
|
||||
r = ciUnderSwarmForge.services.hyperhive.deploy.ci-runner;
|
||||
in
|
||||
r.enable
|
||||
&& r.name == "older-runner"
|
||||
&& r.concurrency == 2
|
||||
&& r.labels == [ "nix:host" ]
|
||||
&& r.package == pkgs.hello
|
||||
&& ciUnderSwarmForge.containers ? swarm-ci-runner
|
||||
&& lib.any (lib.hasInfix "services.hyperhive.swarm.forge.ci.enable") ciUnderSwarmForge.warnings
|
||||
&& !(lib.any (a: !a.assertion) ciUnderSwarmForge.assertions);
|
||||
}
|
||||
{
|
||||
# The rename carries `enable` but not the identity: an old config with
|
||||
# only the old name is refused, and the message says what to set. The
|
||||
# control is the placed pair in `ciUnderForge` above.
|
||||
name = "an old CI enable without a store identity is refused naming the options to set";
|
||||
ok =
|
||||
refusedOver ciUnderForgeNoIdentity "services.hyperhive.deploy.bao.ciRunnerClientCertFile"
|
||||
&& refusedOver ciUnderForgeNoIdentity "services.hyperhive.deploy.bao.ciRunnerClientKeyFile"
|
||||
&& refusedOver ciUnderForgeNoIdentity "services.hyperhive.deploy.bao.enable";
|
||||
}
|
||||
{
|
||||
# Nothing writes the delivery path away from the forge, and a
|
||||
|
|
|
|||
Loading…
Reference in a new issue