-
Notifications
You must be signed in to change notification settings - Fork 524
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nodejs_binary incorrectly chooses the target platform with RBE #1305
Comments
I took a quick look at this and its definitely a bug that needs fixing. The launcher template is expanded on the linux RBE machine where the node tool path is The solution would seem to be to have the launcher template check the platform and call the appropriate node tool which can work for the subset of node toolchains defined already but how would that work with user defined toolchains? |
A bit hacky but the issue can be reproduced in run_targets in bazelci. There doesn’t seem to be a run flags to pass `—config=remote` so I used shell_commands to add the appropriate settings to .bazelrc. No `—remote_executor` is specified but Bazel seems to use a linux VM for local testing of RBE as RBE is used and the build happens on Linux and the result is run on OSX which reproduces the issue.
A bit hacky but the issue can be reproduced in run_targets in bazelci. There doesn’t seem to be a run flags to pass `—config=remote` so I used shell_commands to add the appropriate settings to .bazelrc. No `—remote_executor` is specified but Bazel seems to use a linux VM for local testing of RBE as RBE is used and the build happens on Linux and the result is run on OSX which reproduces the issue.
* node_launcher.sh now picks the node binary at runtime instead of it being a templated arg evaluated at build time * node_binary now adds the correct node tool_files to the nodejs_binary runfiles Fixes bazel-contrib#1305
* node_launcher.sh now picks the node binary at runtime instead of it being a templated arg evaluated at build time * node_binary now adds the correct node tool_files to the nodejs_binary runfiles Fixes bazel-contrib#1305
A bit hacky but the issue can be reproduced in run_targets in bazelci. There doesn’t seem to be a run flags to pass `—config=remote` so I used shell_commands to add the appropriate settings to .bazelrc. No `—remote_executor` is specified but Bazel seems to use a linux VM for local testing of RBE as RBE is used and the build happens on Linux and the result is run on OSX which reproduces the issue.
* node_launcher.sh now picks the node binary at runtime instead of it being a templated arg evaluated at build time * node_binary now adds the correct node tool_files to the nodejs_binary runfiles Fixes bazel-contrib#1305
A bit hacky but the issue can be reproduced in run_targets in bazelci. There doesn’t seem to be a run_flags to pass —config=remote so I used shell_commands to set the --platform to linux in a new mac_fake_rbe job on buildkite. This sets up the same scenario where the build with --platform linux selected (as it would be on RBE) but the resulting nodejs_binary runnable target is run on osx.
* node_launcher.sh now picks the node binary at runtime instead of it being a templated arg evaluated at build time * node_binary now adds the correct node tool_files to the nodejs_binary runfiles Fixes bazel-contrib#1305
A bit hacky but the issue can be reproduced in run_targets in bazelci. There doesn’t seem to be a run_flags to pass —config=remote so I used shell_commands to set the --platform to linux in a new mac_fake_rbe job on buildkite. This sets up the same scenario where the build with --platform linux selected (as it would be on RBE) but the resulting nodejs_binary runnable target is run on osx.
* node_launcher.sh now picks the node binary at runtime instead of it being a templated arg evaluated at build time * node_binary now adds the correct node tool_files to the nodejs_binary runfiles Fixes bazel-contrib#1305
* node_launcher.sh now picks the node binary at runtime instead of it being a templated arg evaluated at build time * node_binary now adds the correct node tool_files to the nodejs_binary runfiles Fixes bazel-contrib#1305
* node_launcher.sh now picks the node binary at runtime instead of it being a templated arg evaluated at build time * node_binary now adds the correct node tool_files to the nodejs_binary runfiles Fixes bazel-contrib#1305
* node_launcher.sh now picks the node binary at runtime instead of it being a templated arg evaluated at build time * node_binary now adds the correct node tool_files to the nodejs_binary runfiles Fixes bazel-contrib#1305
* node_launcher.sh now picks the node binary at runtime instead of it being a templated arg evaluated at build time * node_binary now adds the correct node tool_files to the nodejs_binary runfiles Fixes bazel-contrib#1305
* node_launcher.sh now picks the node binary at runtime instead of it being a templated arg evaluated at build time * node_binary now adds the correct node tool_files to the nodejs_binary runfiles Fixes bazel-contrib#1305
* node_launcher.sh now picks the node binary at runtime instead of it being a templated arg evaluated at build time * node_binary now adds the correct node tool_files to the nodejs_binary runfiles Fixes bazel-contrib#1305
* node_launcher.sh now picks the node binary at runtime instead of it being a templated arg evaluated at build time * node_binary now adds the correct node tool_files to the nodejs_binary runfiles Fixes bazel-contrib#1305
* node_launcher.sh now picks the node binary at runtime instead of it being a templated arg evaluated at build time * node_binary now adds the correct node tool_files to the nodejs_binary runfiles Fixes bazel-contrib#1305
…eb_test_suite (+3 squashed commits) Squashed commits: [d93fb4d] fix: cleanup in node_repositories.bzl [3efce87] test: fix toolchain test now that nodejs_binary chooses the correct runfiles for the host platform Runfiles are no longer tested as what should be tested is that ctx.toolchains["@build_bazel_rules_nodejs//toolchains/node:toolchain_type"].nodeinfo.tool_files are for the correct `--platform`. [7551535] fix: fix nodejs_binary cross-platform RBE issue bazel-contrib#1305 * node_launcher.sh now picks the node binary at runtime instead of it being a templated arg evaluated at build time * node_binary now adds the correct node tool_files to the nodejs_binary runfiles Fixes bazel-contrib#1305
* node_launcher.sh now picks the node binary at runtime instead of it being a templated arg evaluated at build time * node_binary now adds the correct node tool_files to the nodejs_binary runfiles Fixes bazel-contrib#1305
A bit hacky but the issue can be reproduced in run_targets in bazelci. There doesn’t seem to be a run_flags to pass —config=remote so I used shell_commands to set the --platform to linux in a new mac_fake_rbe job on buildkite. This sets up the same scenario where the build with --platform linux selected (as it would be on RBE) but the resulting nodejs_binary runnable target is run on osx.
* node_launcher.sh now picks the node binary at runtime instead of it being a templated arg evaluated at build time * node_binary now adds the correct node tool_files to the nodejs_binary runfiles Fixes bazel-contrib#1305
* node_launcher.sh now picks the node binary at runtime instead of it being a templated arg evaluated at build time * node_binary now adds the correct node tool_files to the nodejs_binary runfiles Fixes bazel-contrib#1305 fix: node
* node_launcher.sh now picks the node binary at runtime instead of it being a templated arg evaluated at build time * node_binary now adds the correct node tool_files to the nodejs_binary runfiles Fixes bazel-contrib#1305 fix: node
A bit hacky but the issue can be reproduced in run_targets in bazelci. There doesn’t seem to be a run_flags to pass —config=remote so I used shell_commands to set the --platform to linux in a new mac_fake_rbe job on buildkite. This sets up the same scenario where the build with --platform linux selected (as it would be on RBE) but the resulting nodejs_binary runnable target is run on osx.
* node_launcher.sh now picks the node binary at runtime instead of it being a templated arg evaluated at build time * node_binary now adds the correct node tool_files to the nodejs_binary runfiles Fixes #1305 fix: node
It appears that
nodejs_binary
incorrectly chooses the platforms for execution of its outputs.I believe this is currently controlled by the block found here
I created a demo/proof in this commit: josephperrott/angular@8dbec8c
Running
yarn bazel run //tools/rbe-test:bin
locally, everything builds and executes as expected and you get the expected console.log message.When running
yarn bazel run //tools/rbe-test:bin --config=remote
to force remote execution, everything builds but then on attempted execution it fails as it can't run the binaryAs you can see from the error message, it is attempting to run the node binary from nodejs_linuxamd64 rather than nodejsdarwin_amd64. This is controlled by line 118 of the
bin.sh
script that is created for the build:Interestingly the line below, 119, correctly identifies the platform:
The text was updated successfully, but these errors were encountered: