Skip to content

feat: multi-runner batches — count input for matrix builds#57

Merged
kurok merged 1 commit into
mainfrom
feat/multi-runner-batches
Jul 2, 2026
Merged

feat: multi-runner batches — count input for matrix builds#57
kurok merged 1 commit into
mainfrom
feat/multi-runner-batches

Conversation

@kurok

@kurok kurok commented Jul 2, 2026

Copy link
Copy Markdown

Closes #45 — roadmap (#49) Phase 3. Sequenced after bootstrap diagnostics (#41), whose per-instance tags make N-way waits debuggable.

Problem

One invocation = one runner. Matrix builds meant N copies of start/stop wired by hand. The action already generates a unique shared label per start — extend "one instance behind a label" to "N behind a label", exactly how GitHub distributes matrix jobs.

What's here

  • count (default 1) + allow-partial (default false). One RunInstances call with MinCount/MaxCount = count (all-or-nothing); allow-partial opts into MinCount 1 with the realized set in outputs + a warning.
  • All-N wait: succeeds only when count runners are online (gh.countOnlineRunners); a bootstrap failure on any instance (aws.getBatchBootstrapStatus) fails fast. On failure/timeout, every instance's console is captured, then all are terminated — no half-fleet leaks.
  • Outputs: ec2-instance-ids (JSON array); ec2-instance-id stays the first id for compat. Signature + TTL tags apply to every instance.
  • Stop: accepts ec2-instance-ids (or the scalar) — terminates all (idempotent; already-gone instances skipped, NotFound no longer burns retries) and deregisters all runners sharing the label (gh.removeAllRunners), with per-instance failure reporting.
  • Zero-diff default: count: 1 outputs/behavior byte-identical. EIP is single-instance only (ignored with a warning for batches). Capacity fallback retries placement for the whole batch (partial placement across subnets out of scope).
  • Removed the now-dead terminateEc2Instance / removeRunner (superseded).

Tests / build

  • launch/fallback/spot now return instanceIds; getBatchBootstrapStatus (first failed across batch), batch handleStartFailure (capture-all-then-terminate-all order + preserve-all), config count validation + stop-with-array. 190 tests pass (was 179). Lint clean, dist rebuilt (verify-dist green).

Docs

README "Matrix builds (multiple runners)" with a full 4-shard workflow; action.yml inputs/outputs.

Out of scope (stated in issue)

Heterogeneous batches (call the action twice); queue-depth autoscaling.

…es, one label)

Matrix builds needed N runners = N hand-wired start/stop jobs + N boot waits.
Now one start launches N instances behind the single shared label GitHub already
distributes matrix jobs across.

- New start inputs: count (default 1) and allow-partial (default false). One
  RunInstances call with MinCount/MaxCount = count (all-or-nothing);
  allow-partial opts into MinCount 1 with the realized set in outputs + a warning.
- Wait completes only when all N runners register (gh.countOnlineRunners); a
  bootstrap failure on ANY instance (aws.getBatchBootstrapStatus) fails fast, and
  handleStartFailure captures every instance's console then terminates them all —
  no half-fleet leaks.
- New outputs: ec2-instance-ids (JSON array); ec2-instance-id stays the first id
  for compat. Signature/TTL tags apply to every instance in the batch.
- Stop accepts ec2-instance-ids (or the scalar): terminates all (idempotent —
  already-gone instances are skipped, and NotFound no longer burns retries) and
  deregisters ALL runners sharing the label (gh.removeAllRunners), with
  per-instance failure reporting.
- count 1 default: outputs/behavior unchanged (regression). EIP is single-
  instance only (ignored with a warning for batches). Capacity fallback retries
  placement for the whole batch.
- Removed now-dead terminateEc2Instance / removeRunner (superseded).

Tests: launch/fallback/spot now return instanceIds; getBatchBootstrapStatus,
batch handleStartFailure (capture-all-then-terminate-all, preserve-all), config
count + stop-with-array validation (190 tests total). README "Matrix builds"
section with a full workflow; action.yml inputs/outputs.

Closes #45

Signed-off-by: kurok <22548029+kurok@users.noreply.github.com>
@kurok kurok merged commit 0c422af into main Jul 2, 2026
5 checks passed
@kurok kurok deleted the feat/multi-runner-batches branch July 2, 2026 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multi-runner batches: count input for matrix builds (N instances, one label)

1 participant