Skip to content
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

[Bug]: js_image_layer is broken with bzlmod #1530

Closed
Tracked by #1671
thesayyn opened this issue Mar 19, 2024 · 7 comments · Fixed by bazel-contrib/rules_nodejs#3750 or #1780
Closed
Tracked by #1671

[Bug]: js_image_layer is broken with bzlmod #1530

thesayyn opened this issue Mar 19, 2024 · 7 comments · Fixed by bazel-contrib/rules_nodejs#3750 or #1780
Labels
bug Something isn't working

Comments

@thesayyn
Copy link
Member

What happened?

Currently, cross compiling js_image_layer through platform attribute is broken due to this line here where linux toolchains are not registered first like it is in the WORKSPACE version.

Version

Development (host) and target OS/architectures:

Output of bazel --version:

Version of the Aspect rules, or other relevant rules from your
WORKSPACE or MODULE.bazel file:

Language(s) and/or frameworks involved:

How to reproduce

When building the image from Darwin to Linux, the following BUILD will produce an image that contains nodejs interpreter for darwin instead of linux.


js_binary(
  name = ":binary"
)

platform(
  name = "linux_amd64",
  constraint_values = [
      "@platforms//os:linux",
      "@platforms//cpu:x86_64",
  ],
)

js_image_layer(
  name = name,
  binary = ":binary",
  platform = ":linux_amd64"
)

Any other information?

No response

@thesayyn thesayyn added the bug Something isn't working label Mar 19, 2024
@github-actions github-actions bot added the untriaged Requires traige label Mar 19, 2024
@markuskobler
Copy link

Is there a simple work around for this issue other than using WORKSPACE?

@thesayyn
Copy link
Member Author

You can use --extra_toolchains command line flag to register linux toolchains first. That should work.

@thesayyn thesayyn removed the untriaged Requires traige label Apr 22, 2024
@thesayyn
Copy link
Member Author

@jbedard @gregmagolan we should make this change in rules_nodejs and include in rules_js 2.0

@gregmagolan
Copy link
Member

@jbedard @gregmagolan we should make this change in rules_nodejs and include in rules_js 2.0

Yes, we should fix this. Possibly fix the cc toolchain coupling in the rules_nodejs provider as well.

@gregmagolan gregmagolan mentioned this issue May 6, 2024
21 tasks
@gregmagolan
Copy link
Member

Duplicate of #1316

@gregmagolan
Copy link
Member

Updated e2e/js_image_oci to build with bzlmod here #1704. That stands-in as a repro for this issue now.

@gregmagolan
Copy link
Member

Landed on main. Fix will be included in the next rules_js 2 RC (current latest is rc4)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
3 participants