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]: project options validation fails with Bazel 6 and run:ci --remote_download_minimal and --remote_download_toplevel #273

Closed
1 task
codesuki opened this issue Dec 12, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@codesuki
Copy link

What happened?

We were using --remote_download_toplevel with Bazel 5.1.1 successfully for some time. Bazel 6 should have brought improvements regarding remote build without the files, but the opposite happened :)

I first considered opening an issue with the Bazel repository, but the Go rules continue to work, so maybe it's something JS/TS specific.

Anyhow, on our CI with the Bazel version mentioned below we get the following error:

(cd /home/jenkins/agent/.bazel_output/sandbox/processwrapper-sandbox/960/execroot/something && \
  exec env - \
    BAZEL_BINDIR=bazel-out/k8-fastbuild/bin \
  bazel-out/k8-opt-exec-2B5CBBC6/bin/external/npm_typescript/validator.sh webv2/tsconfig.json webv2/_validate_ts_options.optionsvalid.d.ts //webv2:ts '{"allow_js":false,"composite":false,"declaration":true,"declaration_map":true,"emit_declaration_only":false,"incremental":false,"preserve_jsx":false,"resolve_json_module":false,"source_map":true,"ts_build_info_file":""}')
# Configuration: e80c887cb3c212bcac599c03a97dce1124e8ca92f4709b732fa485a7a67a2fe6
# Execution platform: @local_config_platform//:host

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module 'typescript'
Require stack:
- /home/jenkins/agent/.bazel_output/sandbox/processwrapper-sandbox/960/execroot/something/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/npm_typescript/validator.sh.runfiles/npm_typescript/ts_project_options_validator.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/home/jenkins/agent/.bazel_output/sandbox/processwrapper-sandbox/960/execroot/something/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/npm_typescript/validator.sh.runfiles/npm_typescript/ts_project_options_validator.js:4:10)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/jenkins/agent/.bazel_output/sandbox/processwrapper-sandbox/960/execroot/something/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/npm_typescript/validator.sh.runfiles/npm_typescript/ts_project_options_validator.js'
  ]
}

This is not the only one though.

FATAL: aspect_rules_js[js_binary]: the entry_point '/home/jenkins/agent/.bazel_output/sandbox/processwrapper-sandbox/388/execroot/something/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/aspect_rules_swc/swc/cli.sh.runfiles/something/../aspect_rules_swc/swc/node_modules/.aspect_rules_js/@swc+cli@0.1.57/node_modules/@swc/cli/./bin/swc.js' not found

It seems all JS dependencies stop working.

Removing --remote_download_... will make the build work again.

I am OK with disabling it since it seems it's not officially stable in Bazel, yet. But I find it curious that it worked with Bazel 5.x.

Version

Development (host) and target OS/architectures:
linux

Output of bazel --version:
6.0.0-pre.20221020.1

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

http_archive(
name = "aspect_rules_js",
sha256 = "50ff9396e707b5fbf8c5e9dbd23777c7c999dddc53a39d511ffecf7c8b285cd6",
strip_prefix = "rules_js-1.9.0",
url = "https://github.com/aspect-build/rules_js/archive/refs/tags/v1.9.0.tar.gz",
)

http_archive(
name = "aspect_rules_ts",
sha256 = "5b501313118b06093497b6429f124b973f99d1eb5a27a1cc372e5d6836360e9d",
strip_prefix = "rules_ts-1.0.2",
url = "https://github.com/aspect-build/rules_ts/archive/refs/tags/v1.0.2.tar.gz",
)

Language(s) and/or frameworks involved:
TS

How to reproduce

Use a remote cache and --remote_download_minimal or --remote_download_toplevel and try to build a ts_project.

Any other information?

No response

Fund our work

  • Sponsor our open source work by donating a bug bounty
@codesuki codesuki added the bug Something isn't working label Dec 12, 2022
@thesayyn
Copy link
Member

Could you try with bazel 6rc4 and see if the problem persists?

There's been a regression in bazel 6 where --remote_download_minimal caused files to be absent in the execroot. bazelbuild/bazel#16789

@codesuki
Copy link
Author

It took a while, but I tried with Bazel 6 release version and it seems to work! Thanks!

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
None yet
Development

No branches or pull requests

2 participants