Skip to content

ci(bazel): harden detect matching + cap matrix concurrency#425

Merged
balajinvda merged 2 commits into
mainfrom
ci/harden-bazel-matrix
Jul 24, 2026
Merged

ci(bazel): harden detect matching + cap matrix concurrency#425
balajinvda merged 2 commits into
mainfrom
ci/harden-bazel-matrix

Conversation

@balajinvda

@balajinvda balajinvda commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Why

Two follow-ups to the change-aware detect job restored in #424:

  1. CodeRabbit flagged that printf ... | grep -q under set -o pipefail can misfire: grep -q closes the pipe on its first match, printf can take SIGPIPE (141), and pipefail then makes the whole pipeline non-zero. In an if, a real match reads as no-match, so a subtree gets silently dropped from the matrix. This is the exact "tests skipped without anyone noticing" failure mode we are trying to prevent.
  2. A full matrix starts ~20 jobs at once, and every runner pulls actions/checkout from codeload.github.com simultaneously, tripping GitHub's action-download rate limit (HTTP 429 in "Set up job"). This has been failing docs-era PRs (docs: update 0.6.1 release candidate manifest #423) and re-runs.

What changed

  1. Replace all four printf '%s\n' "$changed" | grep -q ... sites with a here-string (grep -q PATTERN <<<"$changed"). No pipe, no SIGPIPE, no pipefail interaction. The awk pipelines are unaffected (awk drains stdin, never early-exits).
  2. Add max-parallel: 8 to the bazel matrix so the checkout burst stays under the rate limit. Change-aware scheduling keeps most PRs below the cap; full-matrix events (a workflow change, main push, workflow_dispatch) run in batches.

Customer Release Notes

Not customer visible (CI-only).

Testing

YAML validated; confirmed no printf | grep -q remain and here-strings preserve the existing anchored patterns.

References

Follow-up to #424. CodeRabbit review comment on that PR.

Summary by CodeRabbit

  • Chores
    • Improved workflow change detection to ensure more consistent scheduling of relevant builds.
    • Limited parallel execution of Bazel-related CI jobs to reduce startup/burst load and improve stability.
    • Updated the displayed name for Bazel required checks to be clearer.

Two fixes for the change-aware detect job restored in #424:

1. Replace `printf ... | grep -q` with a here-string (`grep -q PATTERN
   <<<"$changed"`). Under `set -o pipefail`, grep -q closes the pipe on
   its first match and printf can take SIGPIPE (141); pipefail then makes
   the pipeline non-zero, so a real match reads as no-match and the subtree
   is silently dropped from the matrix. The here-string removes the pipe.
   (CodeRabbit finding on #424.)

2. Add max-parallel: 8 to the bazel matrix. A full matrix otherwise starts
   ~20 jobs at once and every runner pulls actions/checkout from
   codeload.github.com in the same instant, tripping GitHub's action
   download rate limit (HTTP 429 in Set up job). Batching keeps the burst
   under the limit; change-aware scheduling keeps most PRs below the cap.

Co-authored-by: Balaji Ganesan <bganesan@nvidia.com>
@balajinvda
balajinvda requested a review from a team as a code owner July 24, 2026 17:13
@balajinvda
balajinvda requested a review from Max-NV July 24, 2026 17:13
@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: dbbbd4f3-4e55-44b3-b462-69d89c3cdb5e

📥 Commits

Reviewing files that changed from the base of the PR and between ca16617 and 830e395.

📒 Files selected for processing (1)
  • .github/workflows/bazel.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/bazel.yml

📝 Walkthrough

Walkthrough

The Bazel workflow updates changed-file matching in the detect job, caps Bazel and Docker matrix concurrency, and renames the verification job display label.

Changes

Bazel workflow scheduling

Layer / File(s) Summary
Changed-file detection matching
.github/workflows/bazel.yml
The detect job replaces printf/grep pipelines with here-string checks for workflow, Java framework, root .bzl, and path-prefix changes.
Bazel matrix concurrency
.github/workflows/bazel.yml
The bazel and bazel-docker matrix strategies set max-parallel to 8 and 4.
Required-check job labeling
.github/workflows/bazel.yml
The bazel-verification display name changes to “bazel required checks”.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • NVIDIA/nvcf#424: Both update Bazel workflow change-aware scheduling logic.

Suggested reviewers: kristinapathak

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title follows Conventional Commits and accurately describes this CI-only Bazel workflow change.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/harden-bazel-matrix

Comment @coderabbitai help to get the list of available commands.

- Add max-parallel to the bazel-docker matrix so the docker-host rows do
  not add to the simultaneous actions/checkout burst (companion to the
  cap on the container bazel job).
- Rename the aggregate gate job from "bazel verification" to "bazel
  required checks" so it is recognizable as the single status check to
  require for merge. Under change-aware scheduling the individual
  bazel (<service>) rows are dynamic and must not be required; this
  always-run rollup is the stable gate.

Co-authored-by: Balaji Ganesan <bganesan@nvidia.com>
@balajinvda
balajinvda added this pull request to the merge queue Jul 24, 2026
Merged via the queue into main with commit 350ad55 Jul 24, 2026
35 checks passed
@balajinvda
balajinvda deleted the ci/harden-bazel-matrix branch July 24, 2026 17:46
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.

2 participants