mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-09 12:17:13 +00:00
The axis was complete in CI and unusable from a workstation. Four separate
gaps, each invisible on a real runner, and each found by running the swarm loop
against it:
`INFINITO_ARCHITECTURES` as an exported variable did nothing, because the
workflow reads its pool from `inputs.architectures`. Passing the input alone did
not help either: ACT_ENV sets INFINITO_APP_DISCOVERY_RUNNER=host, so the
discovery that builds the matrix runs outside the act container, where a
workflow-level `env:` does not reach. This is why the distro axis is handed over
twice, as `distros=` and as `INFINITO_DISTROS`, and SWARM_ARCH now does the same
for the architecture.
The third gap is the sharpest: act does not resolve `${{ matrix.* }}` inside a
job-level `env:` block, so `INFINITO_ARCHITECTURE` reached the assertion empty
every time. Earlier runs only appeared to work because a stale local `.env`
supplied a value, and the assertion was therefore checking a leftover rather
than the row. It surfaced the moment that file was regenerated.
Fourth, act had no mapping for `ubuntu-24.04-arm`, the label RUNNERS
introduced, and skipped the job with a hint instead of failing. It maps to the
same runner image: locally the architecture is delivered by emulation, and the
runner's own hardware is not the promise being made.
`make binfmt` registers that emulation. The handler already existed for
compose-up; it gains a subcommand so the registration is reachable without a
privileged docker invocation, which is what an agent would otherwise have to
ask for every time. The emulation does not survive a swarm run, because act
starts further containers whose systemd clears the shared binfmt registry, so
this is needed often.
Without `arch=`, SWARM_ARCH resolves to the host's own architecture rather than
staying empty, which would now abort every unpinned local swarm run at the
assertion.
Verified: `make binfmt arch=s390x` takes a platform from `exec format error` to
`s390x`; `make -n swarm-zombie arch=arm64` carries arm64 through all three
levers and defaults to amd64 without it; shellcheck passes; a live run reached
`"architecture":"arm64"` with the arm64 glyph in its job title.
Not verified: that the runner-label mapping carries a swarm deploy to the end.
That run was stopped so a parallel agent could use the shared stack.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
81 lines
1.8 KiB
Python
81 lines
1.8 KiB
Python
from __future__ import annotations
|
|
|
|
import argparse
|
|
import importlib
|
|
import importlib.util
|
|
import sys
|
|
from typing import TYPE_CHECKING
|
|
|
|
if TYPE_CHECKING:
|
|
from collections.abc import Iterable
|
|
|
|
|
|
def _module_exists(fullname: str) -> bool:
|
|
return importlib.util.find_spec(fullname) is not None
|
|
|
|
|
|
def _try_import(fullname: str):
|
|
"""
|
|
Import module if it exists, else return None.
|
|
"""
|
|
if not _module_exists(fullname):
|
|
return None
|
|
return importlib.import_module(fullname)
|
|
|
|
|
|
def _iter_command_modules(base_pkg: str, names: Iterable[str]):
|
|
"""
|
|
Yield imported command modules that implement add_parser(sub).
|
|
"""
|
|
for name in names:
|
|
m = _try_import(f"{base_pkg}.{name}")
|
|
if m is None:
|
|
continue
|
|
if hasattr(m, "add_parser"):
|
|
yield name, m
|
|
|
|
|
|
def _build_parser(base_pkg: str) -> argparse.ArgumentParser:
|
|
p = argparse.ArgumentParser(
|
|
prog=f"python -m {base_pkg}",
|
|
description="Infinito.Nexus development compose stack helper.",
|
|
)
|
|
sub = p.add_subparsers(dest="command", required=True)
|
|
|
|
command_names = [
|
|
"binfmt",
|
|
"up",
|
|
"down",
|
|
"stop",
|
|
"restart",
|
|
"build",
|
|
"init",
|
|
"deploy",
|
|
"run",
|
|
"exec",
|
|
"logs",
|
|
]
|
|
|
|
for _, mod in _iter_command_modules(base_pkg, command_names):
|
|
mod.add_parser(sub)
|
|
|
|
return p
|
|
|
|
|
|
def main(argv: list[str] | None = None) -> int:
|
|
if argv is None:
|
|
argv = sys.argv[1:]
|
|
|
|
base_pkg = __package__ or "cli.administration.deploy.development"
|
|
parser = _build_parser(base_pkg)
|
|
|
|
args = parser.parse_args(argv)
|
|
|
|
handler = getattr(args, "_handler", None)
|
|
if handler is None:
|
|
raise SystemExit(
|
|
f"Command '{getattr(args, 'command', '<unknown>')}' has no handler"
|
|
)
|
|
|
|
return int(handler(args))
|