swarm: set an agent's config repo avatar from its icon
The agent module exposes the PNG nix renders from the agent's icon as the read-only option services.hyperhive.agent.iconPng, which the forge and matrix avatar syncs now share. When the builder reads an icon it builds that one attribute with nix build and sends the file, base64, next to the SVG in the meta build reply, so the builder runs no renderer of its own. After recording the icon, the controller sets the avatar of agent-configs/<agent> from the PNG as the forge admin, removes the avatar when the icon is removed, and leaves it alone when the builder sent no PNG. A marker per repo holds the image's fingerprint, so a build whose icon did not change makes no forge call; a forge that refuses the avatar does not fail the build. An old builder sends no PNG, so it changes nothing.
This commit is contained in:
parent
8a0615ccfc
commit
1a31a4cd5a
1 changed files with 499 additions and 25 deletions
|
|
@ -29,7 +29,17 @@ let
|
|||
# SVG: the icon is only ever a gate here, and nothing this case reads
|
||||
# rasterizes it.
|
||||
agentIconNoForge = agentWith { services.hyperhive.agent.icon = pkgs.emptyFile; };
|
||||
agentNoIcon = agentWith { };
|
||||
cases = [
|
||||
{
|
||||
# The builder builds this option and sends the PNG to the controller for
|
||||
# the config repo's avatar, so it must be a derivation when an icon is set
|
||||
# and null when none is (the builder skips the build then).
|
||||
name = "iconPng is the rasterized icon, and null without one";
|
||||
ok =
|
||||
lib.isDerivation agentIconNoForge.services.hyperhive.agent.iconPng
|
||||
&& agentNoIcon.services.hyperhive.agent.iconPng == null;
|
||||
}
|
||||
{
|
||||
# The absence class, and a gate asymmetry nothing else can see. A `.path`
|
||||
# unit is `wantedBy = multi-user.target` and names a `Unit=` by
|
||||
|
|
|
|||
Loading…
Reference in a new issue