diff --git a/.github/workflows/README.md b/.github/workflows/README.md index 1384cf75af..55102904ec 100644 --- a/.github/workflows/README.md +++ b/.github/workflows/README.md @@ -255,7 +255,10 @@ failed chunk: `skipped` counts as passed, so an empty chunk never blocks the chain. After fixing what broke a sweep, `resume_from_chunk` re-enters at that index instead of re-running the green chunks. Both are inputs on `entry-manual-steer.yml`; -the other entry points take the defaults. +the other entry points take the defaults. A retrigger carries the source run's +`chunk_gate` over unless `infinito administration deploy ci trigger +--chunk-gate false` overrides it; the `i8ciallon` alias is `i8ciall` with that +override, for sweeps that should report every chunk before anyone looks. ## Cancellation diff --git a/aliases b/aliases index 4266c40977..540871d52b 100644 --- a/aliases +++ b/aliases @@ -18,6 +18,7 @@ alias i8cepa='m clean-pycache-dirs' alias i8cesa='m clean-stale-nfs' alias i8cesu='m clean-sudo' alias i8ciall='__i8ciall(){ [ -z "${1:-}" ] && { echo "usage: i8ciall " >&2; return 2; }; ghaf "$1" || echo "i8ciall: force-cancel of run $1 reported nothing to cancel; continuing" >&2; infinito administration deploy ci trigger --failed --strict --roles-only --include-unrun --run "$1"; }; __i8ciall' # retrigger everything run $1 (id or url) left without a verdict: a role that truly failed comes back by name, letting the rotation pick the axes, while a row that was aborted, still running, or never reached comes back as itself, axes and all; only a success retires anything; force-cancels the run first so it stops holding runner slots +alias i8ciallon='__i8ciallon(){ [ -z "${1:-}" ] && { echo "usage: i8ciallon " >&2; return 2; }; ghaf "$1" || echo "i8ciallon: force-cancel of run $1 reported nothing to cancel; continuing" >&2; infinito administration deploy ci trigger --failed --strict --roles-only --include-unrun --chunk-gate false --run "$1"; }; __i8ciallon' # like i8ciall, but the retrigger keeps deploying the remaining chunks after a failed one (chunk_gate=false) instead of stopping the chain; the run still ends red alias i8cifail='__i8cifail(){ [ -z "${1:-}" ] && { echo "usage: i8cifail " >&2; return 2; }; ghaf "$1" || echo "i8cifail: force-cancel of run $1 reported nothing to cancel; continuing" >&2; infinito administration deploy ci trigger --failed --run "$1"; }; __i8cifail' # retrigger the exact failed selections (role#variant@mode+tor) of run $1 (id or url) across every mode, plus its never-deployed priority entries, reproducing every other input of that run; force-cancels the run first so it stops holding runner slots alias i8cifo='__i8cifo(){ [ -z "${1:-}" ] && { echo "usage: i8cifo " >&2; return 2; }; ghaf "$1" || echo "i8cifo: force-cancel of run $1 reported nothing to cancel; continuing" >&2; infinito administration deploy ci trigger --failed --strict --run "$1"; }; __i8cifo' # like i8cifail but only hard-failed selections, excluding cancelled/aborted; force-cancels the run first alias i8cire='__i8cire(){ make quality && gips && i8cifail "$1"; }; __i8cire' diff --git a/cli/administration/deploy/ci/trigger/__main__.py b/cli/administration/deploy/ci/trigger/__main__.py index bf81b0ff6c..74f49a3fc4 100644 --- a/cli/administration/deploy/ci/trigger/__main__.py +++ b/cli/administration/deploy/ci/trigger/__main__.py @@ -8,7 +8,9 @@ every other dispatch input is carried over (:func:`runs.carried_inputs`, read off the workflow itself), and the priority line names the exact selections that failed -- role, variant, deploy mode, onion state and distro -- rather than the roles they belong to. The filesystem is left to the rotation -(:mod:`cli.administration.deploy.ci.selections` says why). +(:mod:`cli.administration.deploy.ci.selections` says why). ``--chunk-gate`` is +the one deliberate exception: it overrides the carried value so a retrigger can +keep deploying past a failed chunk. """ from __future__ import annotations @@ -134,6 +136,17 @@ def main(argv: list[str] | None = None) -> int: "named." ), ) + p.add_argument( + "--chunk-gate", + choices=("true", "false"), + default=None, + help=( + "Override the carried chunk_gate input. 'false' keeps deploying " + "the remaining chunks after a failed one instead of stopping the " + "chain; 'true' stops at the first failed chunk. Omitted: the " + "source run's value, else the workflow default." + ), + ) args = p.parse_args(argv) if args.strict and args.failed is None: p.error("--strict only applies with --failed") @@ -193,6 +206,8 @@ def main(argv: list[str] | None = None) -> int: carried_whitelist = config.pop("whitelist", "") if not whitelist and carried_whitelist: whitelist = carried_whitelist + if args.chunk_gate is not None: + config["chunk_gate"] = args.chunk_gate if args.failed is not None: ranking = _ranking(whitelist, config) diff --git a/tests/unit/python/cli/administration/deploy/ci/test_trigger.py b/tests/unit/python/cli/administration/deploy/ci/test_trigger.py index 4989e7f4f9..8ae7fe15f8 100644 --- a/tests/unit/python/cli/administration/deploy/ci/test_trigger.py +++ b/tests/unit/python/cli/administration/deploy/ci/test_trigger.py @@ -265,6 +265,36 @@ class TestTriggerMain(unittest.TestCase): self.assertEqual(rc, 0) self.assertEqual(calls[0], ("web-app-a", "", _SOURCE_CONFIG)) + def test_chunk_gate_override_replaces_the_carried_value(self) -> None: + calls: list = [] + with ( + mock.patch.object(gh, "current_branch", return_value="feature/x"), + mock.patch.object(gh, "resolve_repo", return_value="o/r"), + mock.patch.object(gh, "fetch_run", return_value=_SOURCE_RUN), + mock.patch.object(matrix, "entries_of", return_value=[]), + mock.patch.object( + runs, + "dispatch_workflow", + side_effect=lambda wf, ref, wl="", priority="", config=None, repo=None: ( + calls.append(config) + ), + ), + redirect_stdout(io.StringIO()), + ): + rc = trigger.main(["--failed", "--run", _RUN_URL, "--chunk-gate", "true"]) + self.assertEqual(rc, 0) + self.assertEqual(calls[0], {**_SOURCE_CONFIG, "chunk_gate": "true"}) + + def test_chunk_gate_override_without_a_source_run(self) -> None: + rc, calls = self._run(["--chunk-gate", "false"]) + self.assertEqual(rc, 0) + self.assertEqual(calls[0][4], {"chunk_gate": "false"}) + + def test_chunk_gate_rejects_other_values(self) -> None: + with self.assertRaises(SystemExit) as ctx, redirect_stdout(io.StringIO()): + trigger.main(["--chunk-gate", "maybe"]) + self.assertEqual(ctx.exception.code, 2) + def test_failed_no_run_found(self) -> None: rc, calls = self._run(["--failed"], run=None) self.assertEqual(rc, 1)