aspect-build / aspect-build/rules_js
[Bug]: oci image using js_image_layer with remote exec fails to run
- Dominant language
- Starlark
- Stars
- 378
- Forks
- 183
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 32
Description
### What happened?
Hello!
First of all, thank you for the amazing work maintaining this repo :)
We tried to upgrade our repo to v2.3.3, but when we did so we noticed that our tests on our js images using rules_oci started breaking, but only when remote execution was used.
### Version
Development (host) and target OS/architectures: `linux arm64`
Output of `bazel --version`: `8.1.1`
Version of the Aspect rules, or other relevant rules from your
`WORKSPACE` or `MODULE.bazel` file:
```
bazel_dep(name = "aspect_rules_js", version = "2.3.3")
bazel_dep(name = "rules_oci", version = "2.2.5")
```
Language(s) and/or frameworks involved: javascript / oci
### How to reproduce
```shell
With remote execution: build an image using js_image_layer as one of its tars.
```
Perhaps removing the "no-remote-exec" tag from https://github.com/aspect-build/rules_js/blob/main/e2e/js_image_oci/src/BUILD.bazel#L57 would highlight the error.
### Any other information?
When inspecting the image, the package.json situated in our image would contain the content of the `{js_image_layer_target_name}_launcher` instead of its original content.
Leading to the following error `SyntaxError: Error parsing /path/to/dir/etc/package.json Unexpected token '#', "#!/usr/bin"... is not valid JSON`.
After some investigation we narrowed it down to the `js_image_layer` rule. It would only start working again when setting the `no-remote-exec` tag.
We tracked down the last working commit to https://github.com/aspect-build/rules_js/commit/fff00b6b3bcbdbc44cd5150a326b57e923d29cbe
So we believe the bug was introduced in https://github.com/aspect-build/rules_js/pull/2130, this PR also adds a `no-remote-exec` to the `js_image_layer` of the test.
Contributor guide
Research direction
Start with e2e/js_image_oci/src/BUILD.bazel, especially the js_image_layer usage and its no-remote-exec tag, then compare the behavior with the last working commit and PR 2130. Reproduce the image build with remote execution and inspect package.json in the resulting image. Done means package.json retains its original content and the image runs without the JSON parsing error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100