rules_js icon indicating copy to clipboard operation
rules_js copied to clipboard

Work with RBE and --experimental_allow_unresolved_symlinks enabled once Bazel supports it

Open gregmagolan opened this issue 3 years ago • 7 comments

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.

gregmagolan avatar Jul 26 '22 01:07 gregmagolan

With the 5.3.0 release candidate is this fixed? @gregmagolan

https://groups.google.com/g/bazel-discuss/c/CTrwcVMov0k

mrmeku avatar Aug 09 '22 19:08 mrmeku

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.

gregmagolan avatar Aug 10 '22 05:08 gregmagolan

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

alexeagle avatar Aug 22 '22 22:08 alexeagle

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.

alexeagle avatar Aug 24 '22 03:08 alexeagle

For anyone who wants to try RBE with rules_js or rules_ts now, here are the steps:

  1. 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.
  2. 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-aspect1 in the environment where bazelisk runs, or put aspect-build/6.0.0-aspect1 in your .bazelversion file
  3. Use the newest rules_js release, as we're still making fixes.
  4. Pass the --experimental_allow_unresolved_symlinks flag to Bazel when running with RBE.
  5. Turn on RBE using Bazel's flags. See https://bazel.build/remote/rbe

alexeagle avatar Sep 05 '22 22:09 alexeagle

https://github.com/bazelbuild/bazel/pull/16272 is the PR we expect will fully resolve this, and should make it into Bazel 6.0 :)

alexeagle avatar Sep 16 '22 04:09 alexeagle

https://github.com/bazelbuild/bazel/pull/16272 is landed on master https://github.com/bazelbuild/bazel/commit/d834905a158d253e837597175f4905e23266d0c7

gregmagolan avatar Sep 16 '22 13:09 gregmagolan

Latest rules_js works with Bazel 6.0.0rc2 with RBE. Closing this issue.

gregmagolan avatar Nov 23 '22 08:11 gregmagolan