chore(ci): Convert bash to Go for CI - #23686
Conversation
311a30c to
138e881
Compare
|
✅ No conflicts with other open PRs targeting |
|
4aab405 to
cb9394c
Compare
cb9394c to
eb49693
Compare
eb49693 to
eca0b1d
Compare
There was a problem hiding this comment.
🟡 Changes recommended
There are functional issues in the new matrix generators/CLI (missing CRE smoke overrides, CCIP matrix incompatibilities, and Cobra defaults preventing Action inputs) that could break parity or future workflow migrations.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Risk Rating: MEDIUM — This changes CI matrix generation logic and wires a workflow to a new CLI codepath; failures here can block or misconfigure CI runs.
This PR migrates several GitHub Actions test-matrix generators from ad-hoc bash/jq into the tools/ci Go CLI, aiming for more reliable discovery and easier test coverage.
Changes:
- Added
ci matrixsubcommands (system,in-memory,ccip,mixed-env) plus supporting matrix builders (AST-based Go test discovery and structured entries). - Updated CRE mixed-env workflow to call
ci matrix mixed-envinstead of inline bash/jq. - Refreshed
tools/cidocumentation and.github/AGENTS.mdguidance to prefer the Go CLI over complex workflow shell.
Scrupulous human review recommended (high-impact areas):
- Matrix parity vs existing workflow behavior before swapping TODO’d workflows (especially CRE smoke per-test overrides and CCIP matrix shape/fields).
- CCIP test-name semantics (
go test -runregex expectations) to ensure matrices actually execute the intended tests.
File summaries
| File | Description |
|---|---|
| tools/ci/README.md | Documents new ci matrix subcommands replacing inline matrix scripts |
| tools/ci/internal/matrix/system.go | Builds CRE smoke/regression matrices via Go test discovery and per-test overrides |
| tools/ci/internal/matrix/system_test.go | Unit tests for discovery + CRE smoke/regression matrix generation |
| tools/ci/internal/matrix/mixedenv.go | Builds mixed-env CRE matrix (hardcoded tests + per-test config overrides) |
| tools/ci/internal/matrix/mixedenv_test.go | Tests for mixed-env matrix generation |
| tools/ci/internal/matrix/inmemory.go | Parses .github/in-memory-tests.json into a resolved in-memory test matrix |
| tools/ci/internal/matrix/inmemory_test.go | Tests for in-memory matrix generation + test ID sanitization |
| tools/ci/internal/matrix/discover.go | AST-based discovery of Test*/Example* function names in _test.go files |
| tools/ci/internal/matrix/ccip.go | Builds CCIP system test matrix entries |
| tools/ci/internal/matrix/ccip_test.go | Tests for CCIP system matrix generation |
| tools/ci/cmd/root.go | Registers the new matrix command group |
| tools/ci/cmd/matrix.go | Implements CLI subcommands, resolves common inputs/env, writes GHA outputs |
| tools/ci/cmd/matrix_test.go | CLI-level tests validating JSON output for each matrix subcommand |
| .github/workflows/cre-mixed-env-tests.yaml | Replaces inline jq matrix creation with ci matrix mixed-env |
| .github/AGENTS.md | Updates workflow authoring rules/docs to prefer the Go CI CLI |
Review details
Suppressed comments (2)
tools/ci/cmd/matrix.go:195
fileis given a non-empty Cobra default (".github/in-memory-tests.json"), soif file == "" { file = act.GetInput("file") }never runs. This prevents overriding the config path via GitHub Action inputs.
cmd.Flags().StringVar(&file, "file", ".github/in-memory-tests.json", "Path to in-memory tests configuration JSON")
tools/ci/internal/matrix/ccip.go:59
TestDeleteCCIPJobs-TestRevokeJobswon't match any Go test name when used as ago test -runregex (it becomes^(TestDeleteCCIPJobs-TestRevokeJobs)$in.github/workflows/ccip-system-tests.yaml). The actual tests areTestDeleteCCIPJobsandTestRevokeJobs, so this entry effectively runs nothing. Consider making this field a regex alternation so both tests execute in the same job.
TestName: "TestDeleteCCIPJobs-TestRevokeJobs",
- Files reviewed: 15/15 changed files
- Comments generated: 4
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
e2494f5 to
eb775f2
Compare
e48d19b to
c3fc73c
Compare
c3fc73c to
74ee4b7
Compare
74ee4b7 to
7b36ac7
Compare
7b36ac7 to
0c12607
Compare
0c12607 to
ccdc107
Compare
|





chore(ci): Convert bash to Go for CI
Intent
Replace ad-hoc bash matrix generation (multiline
grepregexes andjqpipelines) in GitHub workflows with typed, testable Go commands undertools/ci matrix. Discovering Go test functions withgrepis brittle and untestable locally; generating matrices in Go enables type-safe configuration, unit + CLI-level test coverage, and uniform runs-on label formatting across test suites. This is groundwork for DX-5101 (runner strategy control in merge queue and releases), which needs a single parameterized place to resolve runs-on labels and spot flags.Big Changes
Centralized test matrix generators (
ci matrix)Added
ci matrix system,ci matrix in-memory,ci matrix ccip, andci matrix mixed-envsubcommands to thetools/ciCLI, backed by a newinternal/matrixpackage. Each command resolves run ID / run attempt / spot flag from flags, action inputs, or GitHub environment (in that order), validates that a run ID is present (empty run IDs would silently produce invalid runner labels), applies defaults, and emits the matrix as a GitHub Actions output (or stdout JSON with--jsonfor local debugging).Generating matrices in Go replaces regex-based test discovery with
go/parserAST walking (DiscoverGoTestNames): deterministic sorted output, per-test topology/config override tables, multi-entry expansion for tests that run under several topologies, and error handling instead of silent grep misses.Mixed-env workflow adoption
cre-mixed-env-tests.yamlnow callsci matrix mixed-envinstead of a 30-line inlinejqscript. The hardcoded test list and per-test config overrides moved tointernal/matrix/mixedenv.go, preserving the exact previous matrix output. No checkout/setup step is needed in the matrix job: the existing$-stylesetup-runner-spotaction already checks out the repo when missing and installs thecibinary viasetup-ci-cli.Small Changes
ci matrix ccip --mixed-version-onlyfilters the matrix to mixed-version tests for release rollout runs.SanitizeTestIDproduces legal artifact names from test file names for the in-memory suite.1andspot=cowhen unset; run ID is validated as required.tools/ci/README.mdcommand table updated with the four new subcommands..github/AGENTS.mdreformatted and now points agents at thetools/ciCLI for non-trivial workflow shell logic.Callouts
internal/matrixtests pin these; reviewers should sanity-check the label formats against the workflows they replace.ci matrix system,in-memory, andccipare implemented and tested but not yet wired into their workflows —cre-system-tests.yaml,cre-regression-system-tests.yaml,ccip-system-tests.yaml, andintegration-in-memory-tests.ymlstill use inline scripts withTODO(DX-5101)markers. Adoption lands in follow-ups; onlymixed-envis live here._test.gofiles excluded by//go:buildtags still contribute test names (same behavior as the old grep). Known limitation, not a regression.Xmdurations; other formats silently default to a 15m job timeout (matches old jq behavior).