read the running rev and the hyperhive flake from /etc files, not the unit
This commit is contained in:
parent
32af7e0639
commit
aed7c8451a
2 changed files with 416 additions and 85 deletions
|
|
@ -258,6 +258,14 @@ in
|
|||
};
|
||||
systemd.services.${forwarderUnit}.serviceConfig.LoadCredential = lib.attrNames storeFiles;
|
||||
|
||||
# The hyperhive source every build is made on. The store path changes
|
||||
# with any edit outside `scripts/` and root-level `*.md`, so it is a
|
||||
# file the daemon re-reads for each build, not part of the unit: a
|
||||
# changed unit restarts the daemon and kills the build in progress.
|
||||
environment.etc."hyperhive/swarm-builder.json".text = builtins.toJSON {
|
||||
hyperhive_flake = hyperhiveFlake;
|
||||
};
|
||||
|
||||
systemd.services.${unit} = {
|
||||
description = "build agent configs for swarm-controller";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
|
@ -281,7 +289,6 @@ in
|
|||
SWARM_BUILDER_NIX = "${nix}/bin/nix";
|
||||
SWARM_BUILDER_CHECK_FLAKE = "${../builder/check-flake}";
|
||||
SWARM_BUILDER_SYSTEM = pkgs.stdenv.hostPlatform.system;
|
||||
SWARM_BUILDER_HYPERHIVE_FLAKE = hyperhiveFlake;
|
||||
SWARM_BUILDER_NIXPKGS_FLAKE = nixpkgsFlake;
|
||||
SWARM_BUILDER_FORGE_URL = "https://${forgeCfg.domain}";
|
||||
SWARM_BUILDER_CONFIG_ORG = "agent-configs";
|
||||
|
|
|
|||
|
|
@ -286,12 +286,18 @@ let
|
|||
# helper answers only `https` for the forge.
|
||||
git_base = "https://${forgeCfg.domain}";
|
||||
github_disabled = !swarmCfg.github.enable;
|
||||
# The rev this controller runs, which `internal/meta` pins hyperhive
|
||||
# to once it descends from the committed pin; null on a dirty tree.
|
||||
hyperhive_rev = config.services.hyperhive.deploy.hive-controller.hyperhiveRev;
|
||||
};
|
||||
};
|
||||
|
||||
# The rev this controller runs, which `internal/meta` pins hyperhive to once
|
||||
# it descends from the committed pin; null on a dirty tree. It is a file the
|
||||
# daemon re-reads on every meta update, not part of the unit: the rev differs
|
||||
# on every commit, and a changed unit restarts the controller and drops its
|
||||
# job graph.
|
||||
runningRevFile = builtins.toJSON {
|
||||
hyperhive_rev = deployCfg.hive-controller.hyperhiveRev;
|
||||
};
|
||||
|
||||
# The swarm's own display name, for `GET /api/swarm` (swarm-ui's chrome).
|
||||
# Gated on the option resolving, not defaulted to an empty string: an
|
||||
# operator who never named the swarm gets `name: null` from the
|
||||
|
|
@ -692,6 +698,9 @@ in
|
|||
serviceConfig.SupplementaryGroups = [ clientsGroup ];
|
||||
};
|
||||
|
||||
# Read by `meta_flake::running_rev`.
|
||||
environment.etc."hyperhive/swarm-controller.json".text = runningRevFile;
|
||||
|
||||
# Installed host-wide, not into the daemon's unit: `swarmctl` is run
|
||||
# by a human on this box and acts as root, so the daemon's sandbox is
|
||||
# exactly what it must not inherit.
|
||||
|
|
|
|||
Loading…
Reference in a new issue