seed a hyperhive/hyperhive mirror so update_meta finds it on a fresh swarm
This commit is contained in:
parent
dbdbed4dcc
commit
a6b5bafa83
1 changed files with 173 additions and 15 deletions
|
|
@ -143,11 +143,17 @@ let
|
|||
"checkout"
|
||||
"upload-artifact"
|
||||
];
|
||||
# The swarm-controller reads the hyperhive repo from this forge (the pin of
|
||||
# the meta flake), so a swarm that has no copy mirrors it.
|
||||
hyperhiveMirrors = lib.optional (deployCfg.forgejo.hyperhiveUpstream != null) {
|
||||
upstream = deployCfg.forgejo.hyperhiveUpstream;
|
||||
dest = "hyperhive/hyperhive";
|
||||
};
|
||||
# Minus any dest the operator already declared, which would duplicate it.
|
||||
effectiveMirrors =
|
||||
deployCfg.forgejo.mirrors
|
||||
++ lib.optionals actionsFromSelf (
|
||||
lib.filter (a: !(lib.any (m: m.dest == a.dest) deployCfg.forgejo.mirrors)) actionMirrors
|
||||
++ lib.filter (a: !(lib.any (m: m.dest == a.dest) deployCfg.forgejo.mirrors)) (
|
||||
lib.optionals actionsFromSelf actionMirrors ++ hyperhiveMirrors
|
||||
);
|
||||
|
||||
# Share host netns — forgejo's HTTP / SSH listeners then look
|
||||
|
|
@ -266,7 +272,8 @@ in
|
|||
With {option}`services.hyperhive.deploy.forgejo.actionsFromSelf`
|
||||
enabled (the default on a host that runs the swarm-controller),
|
||||
`actions/checkout` and `actions/upload-artifact` mirrors are appended
|
||||
to this list.
|
||||
to this list, and so is `hyperhive/hyperhive` with
|
||||
{option}`services.hyperhive.deploy.forgejo.hyperhiveUpstream`.
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
@ -293,13 +300,33 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
hyperhiveUpstream = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
default = null;
|
||||
example = "https://forge.darkest.space/hyperhive/hyperhive";
|
||||
description = ''
|
||||
Clone URL of the hyperhive repo to pull-mirror to `hyperhive/hyperhive`
|
||||
on this forge, or `null` for no mirror. The swarm-controller pins the
|
||||
meta flake's `hyperhive` input to a commit of that repo and every
|
||||
build fetches it from there, so without it the first agent's
|
||||
`update_meta` step fails and no agent container is built.
|
||||
|
||||
Defaults to `https://forge.darkest.space/hyperhive/hyperhive` when this
|
||||
host also runs the swarm-controller, which seeds the mirror (set by
|
||||
`glue-forge-controller.nix`), and to `null` otherwise. The controller
|
||||
creates the mirror only when `hyperhive/hyperhive` does not exist: a
|
||||
swarm that already holds the repo as a normal repo keeps it unchanged. A `hyperhive/hyperhive` entry in
|
||||
{option}`services.hyperhive.deploy.forgejo.mirrors` takes precedence.
|
||||
'';
|
||||
};
|
||||
|
||||
effectiveMirrors = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.attrs;
|
||||
internal = true;
|
||||
readOnly = true;
|
||||
description = ''
|
||||
{option}`mirrors` plus the `actions/*` mirrors {option}`actionsFromSelf`
|
||||
adds; what `glue-forge-controller.nix` forwards to the controller.
|
||||
adds and the `hyperhive/hyperhive` mirror {option}`hyperhiveUpstream` adds; what `glue-forge-controller.nix` forwards to the controller.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
|
@ -1375,8 +1402,8 @@ in
|
|||
# it to be noticed as a missing repo.
|
||||
services.hyperhive.deploy.forgejo.effectiveMirrors = effectiveMirrors;
|
||||
warnings = lib.optional (effectiveMirrors != [ ] && !deployCfg.swarm-controller.enable) ''
|
||||
services.hyperhive.deploy.forgejo.mirrors (or the actions/* mirrors
|
||||
deploy.forgejo.actionsFromSelf adds) is set on a host that does not run the
|
||||
services.hyperhive.deploy.forgejo.mirrors (or the actions/* and hyperhive mirrors
|
||||
deploy.forgejo.actionsFromSelf and hyperhiveUpstream add) is set on a host that does not run the
|
||||
swarm-controller. The controller seeds mirrors from its own host's list,
|
||||
so these are not seeded: declare them on the swarm-controller's host.
|
||||
'';
|
||||
|
|
|
|||
Loading…
Reference in a new issue