Repository navigation
[java] Upgrade rules_jvm_external from v2.10 to v6.10 - #62109
andrew-anyscale wants to merge 2 commits into
Conversation
|
Reviews in this chain: |
|
There was a problem hiding this comment.
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.
a25e63c to
0c71901
Compare
0c71901 to
a436119
Compare
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]>
a436119 to
f8f3261
Compare
|
This pull request has been automatically marked as stale because it has not had 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. |
| @@ -0,0 +1,1454 @@ | |||
| { | |||
There was a problem hiding this comment.
how is this file generated?
There was a problem hiding this comment.
could you add some doc / instructions on how to maintain this file?
## 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]>
## 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]>
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