Skip to content

[java] Upgrade rules_jvm_external from v2.10 to v6.10 - #62109

Open
andrew-anyscale wants to merge 2 commits into
masterfrom
andrew/revup/master/up-jvm-external
Open

andrew-anyscale wants to merge 2 commits into
masterfrom
andrew/revup/master/up-jvm-external

Conversation

@andrew-anyscale

@andrew-anyscale andrew-anyscale commented Mar 26, 2026 •

Copy link
Copy Markdown
Contributor

The old rules_jvm_external v2.10 routes Maven JARs through Bazel's build action graph as stamped outputs, which get uploaded to the remote CAS with stamp-dependent digests. When the cache evicts them, CI builds fail with CacheNotFoundException even though the upstream Maven artifacts are unchanged.

Example failure: https://buildkite.com/ray-project/premerge/builds/63036/steps/canvas?sid=019d2b60-aef2-4055-bca7-2acab543dd3a&tab=output#019d2b7e-3537-47bc-977b-1ea89202c322/L589

Modern rules_jvm_external v6.x fetches Maven JARs as repository rules during the analysis phase, so they never enter the CAS. This eliminates the entire class of CacheNotFoundException failures. A pinned maven_install.json lock file ensures reproducible dependency resolution across machines.

Topic: up-jvm-external
Labels: draft

Co-Authored-By: Claude Opus 4.6 (1M context) [email protected]
Signed-off-by: andrew [email protected]

Postmerge run: https://buildkite.com/ray-project/postmerge/builds/16704

@andrew-anyscale

Copy link
Copy Markdown
Contributor Author

Reviews in this chain:
└#62109 [java] Upgrade rules_jvm_external from v2.10 to v6.10

@andrew-anyscale

andrew-anyscale commented Mar 26, 2026 •

Copy link
Copy Markdown
Contributor Author
# head base diff date summary
0 a25e63c4 40df4994 diff Mar 26 13:06 PM 4 files changed, 1471 insertions(+), 3 deletions(-)
1 0c719016 40df4994 diff Mar 26 13:08 PM 0 files changed
2 a4361198 40df4994 diff Mar 26 13:30 PM 1 file changed, 1 insertion(+)
3 f8f3261b 40df4994 diff Mar 27 6:54 AM 2 files changed, 2 insertions(+)

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates rules_jvm_external to version 6.10 and introduces a Maven lock file (maven_install.json) to improve build reproducibility. It also adds rules_jvm_external_deps and bazel_features_deps to the WORKSPACE. A critical issue was identified where the addition of pinned_maven_install() in the WORKSPACE is redundant and likely to cause build failures, as the maven_install rule is already configured to use the lock file within the existing dependency setup.

Comment thread WORKSPACE Resolved
@andrew-anyscale
andrew-anyscale force-pushed the andrew/revup/master/up-jvm-external branch from a25e63c to 0c71901 Compare March 26, 2026 20:08
@andrew-anyscale andrew-anyscale added the go add ONLY when ready to merge, run all tests label Mar 26, 2026
@andrew-anyscale
andrew-anyscale force-pushed the andrew/revup/master/up-jvm-external branch from 0c71901 to a436119 Compare March 26, 2026 20:30
The old rules_jvm_external v2.10 routes Maven JARs through Bazel's build action graph as stamped outputs, which get uploaded to the remote CAS with stamp-dependent digests. When the cache evicts them, CI builds fail with CacheNotFoundException even though the upstream Maven artifacts are unchanged.

Example failure: https://buildkite.com/ray-project/premerge/builds/63036/steps/canvas?sid=019d2b60-aef2-4055-bca7-2acab543dd3a&tab=output#019d2b7e-3537-47bc-977b-1ea89202c322/L589

Modern rules_jvm_external v6.x fetches Maven JARs as repository rules during the analysis phase, so they never enter the CAS. This eliminates the entire class of CacheNotFoundException failures. A pinned maven_install.json lock file ensures reproducible dependency resolution across machines.

Topic: up-jvm-external
Labels: draft

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Signed-off-by: andrew <[email protected]>
@andrew-anyscale
andrew-anyscale force-pushed the andrew/revup/master/up-jvm-external branch from a436119 to f8f3261 Compare March 27, 2026 13:54
@andrew-anyscale
andrew-anyscale marked this pull request as ready for review March 27, 2026 14:56
@ray-gardener ray-gardener Bot added the core Issues that should be addressed in Ray Core label Mar 27, 2026
@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had
any activity for 14 days. It will be closed in another 14 days if no further activity occurs.
Thank you for your contributions.

You can always ask for help on our discussion forum or Ray's public slack channel.

If you'd like to keep this open, just leave any comment, and the stale label will be removed.

@github-actions github-actions Bot added the stale The issue is stale. It will be closed within 7 days unless there are further conversation label Apr 11, 2026
@aslonnie
aslonnie self-requested a review April 11, 2026 15:40
Comment thread maven_install.json
@@ -0,0 +1,1454 @@
{

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

how is this file generated?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

could you add some doc / instructions on how to maintain this file?

@github-actions github-actions Bot added unstale A PR that has been marked unstale. It will not get marked stale again if this label is on it. and removed stale The issue is stale. It will be closed within 7 days unless there are further conversation labels Apr 12, 2026
elliot-barn added a commit that referenced this pull request Sep 18, 2026
## Why

Ray resolves `rules_python` to **0.9.0**, transitively from
`rules_foreign_cc` 0.9.0. It wins over
protobuf's newer pin because `ray_deps_build_all()` runs
`rules_foreign_cc_dependencies()` before
`grpc_extra_deps()` reaches `protobuf_deps()`, and protobuf declares
`rules_python` through `maybe()`.

0.9.0 pins **pip 22.0.4**, which predates PEP 691 and cannot read a JSON
simple index. That is the
failure documented at length above the `pypi__pip` override in
`WORKSPACE`: an index whose pages are
not HTML makes the resolve fail as though the package did not exist. The
override exists only to work
around this pin, and its own comment ends by noting that aligning it
with the pip
`ci/env/install-dependencies.sh` installs *"means moving rules_python
first."* This does that.

## What

- `rules_python` 0.9.0 -> **0.40.0**, declared in `WORKSPACE` ahead of
the transitive pins so the
`maybe()` in `grpc_deps()` / `protobuf_deps()` /
`rules_foreign_cc_dependencies()` skips theirs.
- `py_repositories()` - newly required to create
`@rules_python_internal`. 0.9.0 had no such call.
- `ignore_root_user_error = True` on `python_register_toolchains()`.

### Why 0.40.0 and not the newest

0.40.0 is the **last release that still ships
`python/pip_install/repositories.bzl`** (loaded by
`WORKSPACE`) and **still accepts `py_runtime_pair(py2_runtime = ...)`**
(used by `bazel/BUILD.bazel`).
Both are gone in 1.0.0. Picking the ceiling of that window means nothing
else in the tree has to
change. The move to 1.x - which rewrites the hermetic py310 toolchain
and retires the `pypi__pip`
override - is deliberately left for a separate change.

### Why `ignore_root_user_error`

rules_python >= ~0.23 chmods the fetched hermetic interpreter read-only,
then touches a file to test
whether it really is read-only; root can still write, so it fails. 0.9.0
had no such check, so this is
a new constraint introduced by the bump, and Ray's CI containers run as
root. Without the flag every
job touching the toolchain fails with `no such package
'@@python3_10_x86_64-unknown-linux-gnu//'`.

The read-only install exists to keep nondeterministic `.pyc` writes out
of the fetched tree. This
toolchain is CI-infra only (see the comment in `bazel/BUILD.bazel`) and
the containers are ephemeral,
so nothing that protection buys is at risk here.

## Not a duplicate

`gh pr list --state open --search` over `bazel version`, `bazelversion`,
`bazelisk`, `bzlmod` and
`upgrade bazel` returns no open PR touching `rules_python` or the
`WORKSPACE` Python setup. The
nearest neighbour is #62109 (`rules_jvm_external` 2.10 -> 6.10), a
different ruleset that does not
overlap this change.

## Tests run

| Command | Result |
|---|---|
| `bazel query //:ray_pkg` | exit 0 |
| `bazel build --nobuild //:ray_pkg_zip //:ray_py_proto_zip` | 2 targets
analyzed, build completed successfully |
| `pre-commit run --files WORKSPACE` | passed |

The second command is the one that matters: it exercises `pip_parse` /
`whl_library` / `pypi__pip` and
the proto path, which `bazel query //:ray_pkg` alone does not reach.

Premerge build 73391 is green - 155 passed, 0 failed. The single earlier
red was a transient
GitHub 500 serving `platforms-0.0.9.tar.gz`, which passed on retry.

## Notes

- `rules_java` was in an earlier revision of this PR and has been
removed. Its 8.x
`rules_java_dependencies()` declares `com_google_protobuf` (29.0-rc2),
`rules_cc` (0.0.15) and
`bazel_skylib` (1.7.1) itself, and because it runs before
`ray_deps_setup()` those `maybe()` calls
won - silently replacing Ray's pinned protobuf with a release candidate.
It needs to move together
  with the protobuf/abseil bump.
- AI assistance was used for the analysis and for drafting this change.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Signed-off-by: elliot-barn <[email protected]>
Co-authored-by: Claude Opus 5 <[email protected]>
nadongjun pushed a commit to nadongjun/ray that referenced this pull request Oct 6, 2026
## Why

Ray resolves `rules_python` to **0.9.0**, transitively from
`rules_foreign_cc` 0.9.0. It wins over
protobuf's newer pin because `ray_deps_build_all()` runs
`rules_foreign_cc_dependencies()` before
`grpc_extra_deps()` reaches `protobuf_deps()`, and protobuf declares
`rules_python` through `maybe()`.

0.9.0 pins **pip 22.0.4**, which predates PEP 691 and cannot read a JSON
simple index. That is the
failure documented at length above the `pypi__pip` override in
`WORKSPACE`: an index whose pages are
not HTML makes the resolve fail as though the package did not exist. The
override exists only to work
around this pin, and its own comment ends by noting that aligning it
with the pip
`ci/env/install-dependencies.sh` installs *"means moving rules_python
first."* This does that.

## What

- `rules_python` 0.9.0 -> **0.40.0**, declared in `WORKSPACE` ahead of
the transitive pins so the
`maybe()` in `grpc_deps()` / `protobuf_deps()` /
`rules_foreign_cc_dependencies()` skips theirs.
- `py_repositories()` - newly required to create
`@rules_python_internal`. 0.9.0 had no such call.
- `ignore_root_user_error = True` on `python_register_toolchains()`.

### Why 0.40.0 and not the newest

0.40.0 is the **last release that still ships
`python/pip_install/repositories.bzl`** (loaded by
`WORKSPACE`) and **still accepts `py_runtime_pair(py2_runtime = ...)`**
(used by `bazel/BUILD.bazel`).
Both are gone in 1.0.0. Picking the ceiling of that window means nothing
else in the tree has to
change. The move to 1.x - which rewrites the hermetic py310 toolchain
and retires the `pypi__pip`
override - is deliberately left for a separate change.

### Why `ignore_root_user_error`

rules_python >= ~0.23 chmods the fetched hermetic interpreter read-only,
then touches a file to test
whether it really is read-only; root can still write, so it fails. 0.9.0
had no such check, so this is
a new constraint introduced by the bump, and Ray's CI containers run as
root. Without the flag every
job touching the toolchain fails with `no such package
'@@python3_10_x86_64-unknown-linux-gnu//'`.

The read-only install exists to keep nondeterministic `.pyc` writes out
of the fetched tree. This
toolchain is CI-infra only (see the comment in `bazel/BUILD.bazel`) and
the containers are ephemeral,
so nothing that protection buys is at risk here.

## Not a duplicate

`gh pr list --state open --search` over `bazel version`, `bazelversion`,
`bazelisk`, `bzlmod` and
`upgrade bazel` returns no open PR touching `rules_python` or the
`WORKSPACE` Python setup. The
nearest neighbour is ray-project#62109 (`rules_jvm_external` 2.10 -> 6.10), a
different ruleset that does not
overlap this change.

## Tests run

| Command | Result |
|---|---|
| `bazel query //:ray_pkg` | exit 0 |
| `bazel build --nobuild //:ray_pkg_zip //:ray_py_proto_zip` | 2 targets
analyzed, build completed successfully |
| `pre-commit run --files WORKSPACE` | passed |

The second command is the one that matters: it exercises `pip_parse` /
`whl_library` / `pypi__pip` and
the proto path, which `bazel query //:ray_pkg` alone does not reach.

Premerge build 73391 is green - 155 passed, 0 failed. The single earlier
red was a transient
GitHub 500 serving `platforms-0.0.9.tar.gz`, which passed on retry.

## Notes

- `rules_java` was in an earlier revision of this PR and has been
removed. Its 8.x
`rules_java_dependencies()` declares `com_google_protobuf` (29.0-rc2),
`rules_cc` (0.0.15) and
`bazel_skylib` (1.7.1) itself, and because it runs before
`ray_deps_setup()` those `maybe()` calls
won - silently replacing Ray's pinned protobuf with a release candidate.
It needs to move together
  with the protobuf/abseil bump.
- AI assistance was used for the analysis and for drafting this change.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Signed-off-by: elliot-barn <[email protected]>
Co-authored-by: Claude Opus 5 <[email protected]>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Issues that should be addressed in Ray Core go add ONLY when ready to merge, run all tests unstale A PR that has been marked unstale. It will not get marked stale again if this label is on it.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants