Skip to content

ci(e2e): shard scenarios across a retrying matrix - #405

Merged
joshua-temple merged 1 commit into
mainfrom
ci/shard-e2e-scenarios
Jun 27, 2026
Merged

joshua-temple merged 1 commit into
mainfrom
ci/shard-e2e-scenarios

Conversation

@joshua-temple

Copy link
Copy Markdown
Collaborator

Problem

The e2e suite runs 76 multistep scenarios serially on ONE runner (E2E_PARALLEL=1). Any single per-scenario environmental flake (act startup, Docker exec timing) reds the whole ~45-min job, forcing admin-overrides to merge unrelated PRs.

Fix

Shard the scenarios across a fail-fast:false matrix of 5 serial legs (~15 each, ~9 min parallel), each with 3 attempts (gotestsum --rerun-fails=2, rerunning only the failed scenarios). A flake now self-heals within a leg, or is an isolated ~9-min single-shard rerun instead of a 45-min full-suite gamble.

  • e2e/harness/shard.go: ShardFromEnv (E2E_SHARD_INDEX/TOTAL, default 0-of-1 so local go test is unchanged), round-robin SelectShard (complete + disjoint partition), FNV Owns for standalone heavy tests (each runs once across the fleet). Unit-tested -race.
  • e2e.yaml: a plan job computes the shard matrix; gate needs all legs (green only if every shard passes). Workflow name: and gate identity unchanged (fleet-e2e's workflow_run depends on them).
  • Single-element dispatch: shard=N input runs only that leg; scenario=<regex> input collapses the matrix and runs only matching scenarios (Go-side E2E_SCENARIO filter, since gotestsum does not honor passthrough -run).

Proof (local Docker)

total=1 -> 76 scenarios; shard 0/5 ran its subset (PASS) and the same scenario was absent from shard 1; E2E_SCENARIO selected exactly 1 and ran only it (PASS); gotestsum drove the retries. go build/vet/lint/actionlint, shard unit tests -race, and main go test (2021 pass) all clean.

This PR's own CI is the first live run of the sharded matrix. Addresses the e2e flakiness that forced recent admin-merges.

Run the 76 multistep scenarios as a fail-fast:false matrix of 5 serial shards instead of one serial 45-minute job, so a flake is an isolated ~9-minute single-shard rerun. gotestsum --rerun-fails=2 gives each leg 3 attempts, rerunning only failed scenarios. workflow_dispatch shard and scenario inputs collapse the matrix to one leg or one scenario for targeted runs. The Integration Gate aggregates all legs; the workflow name and gate identity are unchanged.

Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
@joshua-temple
joshua-temple enabled auto-merge (squash) June 27, 2026 22:59
@joshua-temple
joshua-temple merged commit 260a5c8 into main Jun 27, 2026
18 checks passed
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.

1 participant