fix: use 1-based runner indices for Gitea Actions compatibility

This commit is contained in:
2026-06-22 02:31:20 +00:00
parent 8c16703106
commit 1f75017395
4 changed files with 21 additions and 15 deletions
+6 -3
View File
@@ -9,7 +9,7 @@ Each pair is printed as ``scenario|platform_name|platform_image|platform_command
so the CI workflow can set the appropriate environment variables.
Usage:
python3 scripts/distribute_molecule.py --runner-index 0 --max-runners 3
python3 scripts/distribute_molecule.py --runner-index 1 --max-runners 3
# prints: default|ubuntu-2204|ubuntu:22.04| lifecycle|ubuntu-2204|ubuntu:22.04| ...
python3 scripts/distribute_molecule.py --list
# prints all scenarios, one per line
@@ -105,7 +105,8 @@ def pairs_for_runner(pairs: list[TestPair], runner_index: int, max_runners: int)
"--runner-index",
type=int,
default=None,
help="Zero-based runner index. If omitted, prints all groups.",
help="One-based runner index (Gitea Actions renders 0 as empty). "
"Converted to zero-based internally. If omitted, prints all groups.",
)
@click.option(
"--max-runners",
@@ -143,7 +144,9 @@ def cli(runner_index: int | None, max_runners: int, list_all: bool, list_platfor
labels = " ".join(p.encode() for p in group) if group else "(none)"
click.echo(f"Runner {i}: {labels}")
return
assigned = pairs_for_runner(pairs, runner_index, max_runners)
# Convert 1-based CLI index to 0-based internal index
zero_based = runner_index - 1
assigned = pairs_for_runner(pairs, zero_based, max_runners)
click.echo(" ".join(p.encode() for p in assigned))