feat(swarm-test): run both arms of the axis through the same round

The meshed round was its own shape: a mesh-only first pass, one
application deploy, and a second only when a drill needed one. Comparing it
with the direct arm meant adjusting for a missing pass and a stripped browser
suite, and every timing answer carried a caveat.

Both arms now run deploy, converge, drill, redeploy, converge, verify. What
the mesh needs moves into a prologue that installs no role: tunnel up on every
node, keys rotated, controller joined, transport switched. Both application
passes then run over the tunnel and both print their PASS banner, so a meshed
row and a direct row differ only in how they were reached.

The credential reset stays in the prologue rather than moving to the direct
arm's slot between the passes. Its mirror copies the manager's host_vars over
every other host, keeping only applications.svc-net-wireguard, so after the
switch every worker would inherit the manager's mesh address and three
connections would land on one node.

The drill probe now gates both arms. A backup host deployed for an application
with no NFS-flagged volume is several minutes spent on a drill that skips
itself, and that was true on the direct arm before this branch existed.
This commit is contained in:
evangelostsak committed 2026-10-06 02:35:54 +02:00
1 parent 996febdc89
commit 6b27280644
1 file changed
+37 -29
+37 -29
View File
@@ -117,14 +117,11 @@ def _deploy(
round_index: int,
total: int,
update_pass: bool = False,
dr_prepass: bool = False,
) -> int:
"""Run one deploy of the round.
Args:
update_pass: run it as the async update pass.
dr_prepass: this pass is torn down by the drill, so it leaves the
end-to-end suites to the pass that follows the drill.
"""
env = os.environ.copy()
env["APP_ID"] = app_id
@@ -147,8 +144,6 @@ def _deploy(
"-e",
f"PRIMARY_APPS={json.dumps([app_id])}",
]
if dr_prepass:
cmd += ["-e", "SWARM_DR_PREPASS=true"]
pass_label = (
f"matrix-deploy: round {round_index + 1}/{total} "
f"variants=[{round_index}] apps=['{app_id}']"
@@ -259,6 +254,35 @@ def _verify_recovered_marker(*, app_id: str) -> int:
)
def _mesh_prologue(*, app_id: str, inv_dir: str, round_variants: dict[str, int]) -> int:
"""Put every node and the controller on the mesh, then move the transport.
The credential reset runs here rather than between the passes, where the
direct arm has it: its mirror copies the manager's host_vars over every
other host, which after the switch would hand every worker the manager's
mesh address.
Args:
app_id: primary application of the round.
inv_dir: inventory directory of the round.
round_variants: the round's ``{app_id: variant_index}`` map.
"""
rc = bootstrap_mesh(inv_dir=inv_dir)
if rc == 0:
rc = _reset_credentials(
app_id=app_id, inv_dir=inv_dir, round_variants=round_variants
)
if rc == 0:
rc = write_mesh(inv_dir=inv_dir, rotate=True)
if rc == 0:
rc = converge_mesh(inv_dir=inv_dir)
if rc == 0:
rc = mesh_controller(inv_dir=inv_dir)
if rc == 0:
rc = switch_to_mesh_transport(inv_dir=inv_dir)
return rc
def _purge(*, purge_set: tuple[str, ...]) -> int:
if not purge_set:
return 0
@@ -405,46 +429,30 @@ def main(argv: list[str] | None = None) -> int:
}
drills = (
rc == 0
and meshed
and round_index == 0
and _drill_is_coming(
app_id=app_id, inv_dir=inv_root, extras_path=extras_path
)
)
if rc == 0 and meshed:
rc = _mesh_prologue(
app_id=app_id, inv_dir=inv_root, round_variants=round_variants
)
if rc == 0:
rc = _deploy(**deploy_args)
if rc == 0:
rc = bootstrap_mesh(inv_dir=inv_root) if meshed else _deploy(**deploy_args)
if rc == 0 and not meshed:
rc = _converge_and_verify(app_id=app_id)
if rc == 0 and not meshed and round_index == 0:
if rc == 0 and drills:
rc = _backup_phase(
app_id=app_id,
inv_dir=inv_root,
deploy_extras=deploy_extras,
drill_extras=extras_path,
)
if rc == 0:
if rc == 0 and not meshed:
rc = _reset_credentials(
app_id=app_id, inv_dir=inv_root, round_variants=round_variants
)
if rc == 0:
rc = write_mesh(inv_dir=inv_root, rotate=True)
if rc == 0:
rc = converge_mesh(inv_dir=inv_root)
if rc == 0:
rc = mesh_controller(inv_dir=inv_root)
if rc == 0:
rc = switch_to_mesh_transport(inv_dir=inv_root)
if rc == 0 and drills:
rc = _deploy(**deploy_args, update_pass=True, dr_prepass=True)
if rc == 0:
rc = _converge_and_verify(app_id=app_id)
if rc == 0:
rc = _backup_phase(
app_id=app_id,
inv_dir=inv_root,
deploy_extras=deploy_extras,
drill_extras=extras_path,
)
if rc == 0:
rc = _deploy(**deploy_args, update_pass=True)
if rc == 0: