mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-09 12:17:13 +00:00
Every deploy row now takes a node network mode, clearnet, tor or multi, instead of an onion yes or no. The workflow input `network` (auto|clearnet|tor|multi) replaces `tor`, and INFINITO_NETWORK replaces INFINITO_TOR. utils/github/variant/network.py decides which modes a row can take: clearnet only without a Tor bond or when the variant pins Tor off, no multi for a single_mode role, no clearnet for the Tor provider, whose rows are therefore no longer dropped when the rotation lands on clearnet. Priority rows cover every mode and network combination, regular rows rotate the network on sweep // 2, and clearnet rows carry disable=tor. Selection tokens pin the axis with +clearnet, +tor or +multi, and multi rows wear the new glyph. A row hands its mode to the deploy as the variable `network`, which provisioning writes into host_vars as NETWORK_MODE. Without it the node keeps deriving its mode from the deployed providers. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
69 lines
2.7 KiB
Python
69 lines
2.7 KiB
Python
"""Which matrix entry replays its role's README instructions.
|
|
|
|
The replay used to be a job of its own, picking one random role per run. It
|
|
rides on a deploy row instead: the role's smallest variant among the rows this
|
|
sweep actually deploys, marked with ``instructions`` (the mode the replay runs
|
|
in) and a 📖 in the job title. :mod:`utils.roles.guide` decides which variant
|
|
that is; this module is what turns the decision into matrix entries.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import TYPE_CHECKING
|
|
|
|
from utils.roles.guide import guide_deployable, guide_variant
|
|
from utils.symbol_glossary import to_emoji
|
|
|
|
if TYPE_CHECKING:
|
|
from collections.abc import Mapping, Sequence
|
|
from typing import Any
|
|
|
|
|
|
def redundant(entry: Mapping[str, str]) -> bool:
|
|
"""Whether the sweep drops this row as coverage an earlier row already has."""
|
|
if entry["priority"] == "true":
|
|
return False
|
|
return entry["clone"] == "true" or entry["covered"] != "0"
|
|
|
|
|
|
def mark(
|
|
entries: list[dict[str, str]],
|
|
variants_per_app: Mapping[str, Sequence[Mapping[str, Any]]] | None,
|
|
) -> list[dict[str, str]]:
|
|
"""Hand one entry per role the replay, and give its label the 📖.
|
|
|
|
Only the first entry of the chosen variant: a priority row runs every mode
|
|
and network mode it offers, and replaying the same README block in each of
|
|
them proves nothing the first replay did not. The glyph goes between the
|
|
variant number and the ⭐ of a priority row, with no space between the two:
|
|
they are one marker block, not two axes.
|
|
|
|
The row has to run in the guide's own mode. The replay is a second deploy
|
|
on the same runner, so hanging it on a swarm row would ask that runner to
|
|
bring a compose stack up beside a swarm one. Only rows in that mode count
|
|
as deployed here either, so the variant search cannot settle on one that
|
|
this sweep runs in swarm alone.
|
|
"""
|
|
star = f" {to_emoji('priority')}"
|
|
deployed: dict[str, set[str]] = {}
|
|
for entry in entries:
|
|
app = entry["apps"]
|
|
if not redundant(entry) and entry["mode"] == guide_deployable(app):
|
|
deployed.setdefault(app, set()).add(entry["variant"])
|
|
marked: set[str] = set()
|
|
for entry in entries:
|
|
app = entry["apps"]
|
|
if app in marked or redundant(entry):
|
|
continue
|
|
variant, mode = guide_variant(app, variants_per_app, deployed.get(app, set()))
|
|
if not mode or entry["variant"] != variant or entry["mode"] != mode:
|
|
continue
|
|
entry["instructions"] = mode
|
|
entry["label"] = (
|
|
entry["label"].removesuffix(star)
|
|
+ f" {to_emoji('instructions')}"
|
|
+ (to_emoji("priority") if entry["priority"] == "true" else "")
|
|
)
|
|
marked.add(app)
|
|
return entries
|