Skip to content

build(bazel): migrate the monorepo toolchain from 8.6.0 to 9.1.1#276

Merged
balajinvda merged 1 commit into
mainfrom
chore/bazel-9-1-1
Jul 21, 2026
Merged

build(bazel): migrate the monorepo toolchain from 8.6.0 to 9.1.1#276
balajinvda merged 1 commit into
mainfrom
chore/bazel-9-1-1

Conversation

@balajinvda

@balajinvda balajinvda commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Why

The nv-boot-parent Java import (coming next) was validated on Bazel 9.1.1, and its rules stack (rules_java 9.x, rules_jvm_external 7.0) needs Bazel 9. Bumping the root toolchain is a repository-wide change that touches the shared remote-cache config and every service's build, so it is split out here as its own reviewable step ahead of the Java import.

What changed

Bazel 9 removed several globals and flags; this migrates the root config:

  • .bazelversion -> 9.1.1.
  • .bazelrc: drop --experimental_remote_merkle_tree_cache[_size] (removed in 9; falls back to the default --experimental_remote_discard_merkle_trees). Add --@com_google_protobuf//bazel/toolchains:allow_nonstandard_protoc (see protoc note).
  • rules/java/private/spring_boot.bzl: load JavaInfo from @rules_java//java/common (no longer a global).
  • src/libraries/go/lib/BUILD.bazel: load sh_test from @rules_shell (no longer a global); add the rules_shell module dep.
  • MODULE.bazel: Bazel 9.1.1 resolves the protobuf module to 33.4. toolchains_protoc 0.6.1 (latest) ships protoc v33.0 but not 33.4, so pin protoc v33.0 (same major, compiles 33.4's protos) and allow the skew. protobuf is declared directly with repo_name = com_google_protobuf so the .bazelrc flag resolves.
  • .bazelignore: temporarily exclude examples/java-spring-boot-service (contrib_rules_jvm 0.27.0 predates Bazel 9); re-included by the nv-boot import PR that bumps the Java rules stack.

Customer Release Notes

Not customer visible. Build toolchain change.

Plan Summary

Not applicable.

Usage

bazel (bazelisk) reads .bazelversion and fetches 9.1.1 automatically; no local action needed.

Testing

bazel build //... completes cleanly on 9.1.1 locally: 5209 total actions, fully cacheless (no remote cache), so the result is independent of the nvcfbarn cache. CI runs the same on the change-aware bazel matrix.

Notes

The nvcfbarn remote-cache "lost inputs" transients seen mid-migration are the known cache-resilience issue (handled in CI by --remote_download_all), not a 9.1.1 problem; the cacheless build proves that.

References

NO-REF

Related Merge Requests/Pull Requests

Precedes the nv-boot-parent import (#269), which rebases onto this and re-includes the Java example with the Java rules-stack bump.

Dependencies

Adds module deps rules_shell 0.8.0 and a direct protobuf 33.4 (aliased com_google_protobuf); bumps the pinned protoc toolchain to v33.0. All from the Bazel Central Registry; no license change.

Summary by CodeRabbit

  • Build Improvements

    • Updated build toolchain requirement to Bazel 9.1.1.
    • Refreshed protobuf tooling to improve protoc compatibility (including protobuf version skew).
    • Updated Java runtime classpath handling for transitive runtime jars.
    • Improved shell-based test support by explicitly loading the shell test rule.
  • Dependency Updates

    • Added/updated Bazel module dependencies and versions, including upgrading Java build foundation rules.
    • Regenerated Maven dependency metadata and resolution hashes, with conflict-resolution adjustments.
  • Configuration

    • Updated Bazel cache settings and Maven repository mirroring behavior.
    • Added a Bazel ignore rule for a specific examples directory.

@balajinvda
balajinvda requested a review from a team as a code owner July 20, 2026 22:25
@coderabbitai

coderabbitai Bot commented Jul 20, 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: 80835854-bb60-452d-ace5-ccc6dbc01d28

📥 Commits

Reviewing files that changed from the base of the PR and between 92eed69 and d471985.

⛔ Files ignored due to path filters (1)
  • MODULE.bazel.lock is excluded by !**/*.lock, !**/MODULE.bazel.lock
📒 Files selected for processing (7)
  • .bazelignore
  • .bazelrc
  • .bazelversion
  • MODULE.bazel
  • maven_install.json
  • rules/java/private/spring_boot.bzl
  • src/libraries/go/lib/BUILD.bazel
🚧 Files skipped from review as they are similar to previous changes (6)
  • .bazelversion
  • src/libraries/go/lib/BUILD.bazel
  • .bazelignore
  • .bazelrc
  • MODULE.bazel
  • maven_install.json

📝 Walkthrough

Walkthrough

The project upgrades Bazel to 9.1.1, updates protobuf and Java tooling, regenerates Maven dependency metadata, adjusts Bazel compatibility settings, and imports required shell-test and Java provider rules.

Changes

Bazel upgrade and build integration

Layer / File(s) Summary
Bazel and protobuf toolchain versions
.bazelversion, MODULE.bazel, .bazelrc
Bazel is updated to 9.1.1, protobuf is pinned to 33.4, the prebuilt protoc toolchain is updated to v33.0, and nonstandard protoc usage is enabled.
Java dependency metadata refresh
MODULE.bazel, maven_install.json
Java tooling versions are bumped, public Maven mirrors are configured, and Maven artifact hashes, conflict resolution, dependencies, packages, repositories, and service metadata are regenerated.
Bazel 9 compatibility settings
.bazelignore, .bazelrc
The Java Spring Boot example is ignored for Bazel 9 compatibility, and explicit experimental in-memory Merkle tree cache settings are removed.
Bazel rule loading integrations
MODULE.bazel, src/libraries/go/lib/BUILD.bazel, rules/java/private/spring_boot.bzl
rules_shell is added, sh_test is loaded for the Go lint wrapper, and JavaInfo is loaded for the Spring Boot rule.

Estimated code review effort: 3 (Moderate) | ~25 minutes

🚥 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 accurately summarizes the main change: upgrading the monorepo Bazel toolchain from 8.6.0 to 9.1.1.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/bazel-9-1-1

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

@github-actions

Copy link
Copy Markdown

🛡️ CodeQL Analysis

🚨 Found 2 issue(s)

Severity Breakdown:

  • 🔴 Errors: 0
  • 🟡 Warnings: 0
  • 🔵 Notes: 0
📋 Top Issues

🔗 View full details in Security tab

🕐 Last updated: 2026-07-20 22:28:22 UTC | Commit: 2da97b8

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.bazelrc (1)

137-140: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Remove the stale Merkle-cache documentation.

The configuration flags were removed, but these comments still claim that a 10,000-entry Merkle tree cache is configured. Update or remove this block so operators are not misled about the active Bazel 9 settings.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.bazelrc around lines 137 - 140, Remove the stale Merkle-cache comment block
in the Bazel configuration, including its claims about 10,000-entry caching and
JVM heap usage. Do not add replacement documentation unless it describes active
Bazel 9 settings.
🧹 Nitpick comments (1)
.bazelignore (1)

55-57: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy lift

Preserve validation coverage for the excluded Spring Boot example.

Because examples/java-spring-boot-service is excluded, bazel build //... no longer exercises the consumer of rules/java/private/spring_boot.bzl. Add an explicit CI or targeted validation for this example while the temporary exclusion remains.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.bazelignore around lines 55 - 57, Add explicit CI or targeted Bazel
validation for examples/java-spring-boot-service so its consumer coverage of
rules/java/private/spring_boot.bzl remains exercised while the .bazelignore
exclusion is present. Keep the exclusion unchanged and wire validation into the
existing repository check mechanism.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In @.bazelrc:
- Around line 137-140: Remove the stale Merkle-cache comment block in the Bazel
configuration, including its claims about 10,000-entry caching and JVM heap
usage. Do not add replacement documentation unless it describes active Bazel 9
settings.

---

Nitpick comments:
In @.bazelignore:
- Around line 55-57: Add explicit CI or targeted Bazel validation for
examples/java-spring-boot-service so its consumer coverage of
rules/java/private/spring_boot.bzl remains exercised while the .bazelignore
exclusion is present. Keep the exclusion unchanged and wire validation into the
existing repository check mechanism.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 83213f8e-2533-471e-a825-75efdc0804ec

📥 Commits

Reviewing files that changed from the base of the PR and between 957a93f and 2da97b8.

⛔ Files ignored due to path filters (1)
  • MODULE.bazel.lock is excluded by !**/*.lock, !**/MODULE.bazel.lock
📒 Files selected for processing (6)
  • .bazelignore
  • .bazelrc
  • .bazelversion
  • MODULE.bazel
  • rules/java/private/spring_boot.bzl
  • src/libraries/go/lib/BUILD.bazel

Bump the root Bazel toolchain to 9.1.1 ahead of the Java (nv-boot-parent)
import, which was validated on 9.1.1. This is a repository-wide toolchain
change kept separate from the Java import so each is reviewable on its own.
Nothing that built on 8.6.0 is disabled: the whole tree still builds on 9.1.1.

Bazel 9 removals and their fixes:
- .bazelrc: drop --experimental_remote_merkle_tree_cache[_size] (removed in 9;
  behavior falls back to the default --experimental_remote_discard_merkle_trees).
- rules/java/private/spring_boot.bzl: load JavaInfo from @rules_java//java/common
  (no longer a global).
- src/libraries/go/lib/BUILD.bazel: load sh_test from @rules_shell (no longer a
  global); add the rules_shell module dep.

Java rules stack (keeps examples/java-spring-boot-service building on 9.1.1):
- contrib_rules_jvm 0.27.0 -> 0.33.0 (0.27.0's spotbugs_config.bzl uses the
  removed global JavaInfo); rules_jvm_external 6.7 -> 7.0.
- Maven hub repositories are now public Central mirrors only. The public GitHub
  runners cannot resolve the internal Artifactory host, so the pinned closure
  must fetch from public repos; re-pinned maven_install.json accordingly. Also
  removes the internal hostname from the public repo.

protoc/protobuf alignment:
- Bazel 9.1.1 resolves the protobuf module to 33.4. toolchains_protoc 0.6.1
  (latest) ships protoc v33.0 but not 33.4, so pin protoc v33.0 (same major,
  compiles 33.4's protos) and allow the 33.0-vs-33.4 skew via
  --@com_google_protobuf//bazel/toolchains:allow_nonstandard_protoc. protobuf is
  declared directly with repo_name com_google_protobuf so that flag resolves.

Validated locally: `bazel build //...` completes cleanly on 9.1.1 (fully
cacheless), including the Java example.

Co-authored-by: Balaji Ganesan <bganesan@nvidia.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@balajinvda
balajinvda added this pull request to the merge queue Jul 21, 2026
Merged via the queue into main with commit ac9f7fb Jul 21, 2026
17 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.

2 participants