Work with RBE and --experimental_allow_unresolved_symlinks enabled once Bazel supports it
With https://github.com/aspect-build/rules_js/pull/283 landed, rules_js will now use the ctx.actions.declare_symlink API to create all of the symlinks in the symlinks node_modules tree if the --experimental_allow_unresolved_symlinks flag is set.
This feature is not yet stable in Bazel (see https://github.com/bazelbuild/bazel/issues/10298) and is currently being stabilized by @fmeum split across multiple PRs to bazel such as https://github.com/bazelbuild/bazel/pull/15963.
This can slip the 1.0 milestone since it depends on when things land in Bazel. It is here for now for visibility on the roadmap for users.
With the 5.3.0 release candidate is this fixed? @gregmagolan
https://groups.google.com/g/bazel-discuss/c/CTrwcVMov0k
It will not. It looks like 6.0 is where they will land. Relevant issue to follow the progress is this one https://github.com/bazelbuild/bazel/issues/10298.
With https://github.com/bazelbuild/bazel/pull/15781 landed today, we think the only remaining issue with Bazel at HEAD preventing rules_js on RBE is https://github.com/bazelbuild/bazel/issues/14224
https://github.com/aspect-build/rules_js/pull/400 shows that rules_js is now working with RBE at HEAD!
However it requires one change to Bazel which is on this fork: https://github.com/aspect-build/bazel/releases/tag/6.0.0-aspect1
https://github.com/aspect-build/rules_js/blob/main/.github/workflows/ci.yaml#L56 shows where we select our fork for RBE builds on CI.
For anyone who wants to try RBE with rules_js or rules_ts now, here are the steps:
- Decide where you want to enable this. Since there is no release of Bazel which has all the needed fixes (as of this writing) you'll need to use a fork of Bazel. You have to decide if you're okay with the risk of updating your "production" Bazel version that all developers use, or maybe try this out only on a branch, or maybe use the newer Bazel only on CI and not for local development.
- Use our fork: https://github.com/aspect-build/bazel/releases/tag/6.0.0-aspect1 which currently supports only Linux x86 and MacOS on x86 or Apple Silicon. Use the usual configuration affordances in https://github.com/bazelbuild/bazelisk - for example put
USE_BAZEL_VERSION=aspect-build/6.0.0-aspect1in the environment where bazelisk runs, or putaspect-build/6.0.0-aspect1in your.bazelversionfile - Use the newest rules_js release, as we're still making fixes.
- Pass the
--experimental_allow_unresolved_symlinksflag to Bazel when running with RBE. - Turn on RBE using Bazel's flags. See https://bazel.build/remote/rbe
https://github.com/bazelbuild/bazel/pull/16272 is the PR we expect will fully resolve this, and should make it into Bazel 6.0 :)
https://github.com/bazelbuild/bazel/pull/16272 is landed on master https://github.com/bazelbuild/bazel/commit/d834905a158d253e837597175f4905e23266d0c7
Latest rules_js works with Bazel 6.0.0rc2 with RBE. Closing this issue.