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]: In some cases --output_base makes builds using external binaries fail #805

Open
1 task
rdfirtal opened this issue Jan 17, 2023 · 0 comments
Open
1 task
Labels
bug Something isn't working

Comments

@rdfirtal
Copy link

What happened?

When running builds in Gitlab with local caches, the cached directories must exist within the workspace folder. Because of this, every Bazel command must be run with the bazel --output_base=some-dir option (or put a line in the .bazelrc file with startup --output_base=some-dir)

However, that flag breaks some binaries, for instance, Vuepress if the generated binary is used:

load("@npm//:vitepress/package_json.bzl", vitepress = "bin")

vitepress.vitepress(
    name = "app",
    srcs = [ "index.md", "//:node_modules/vue" ],
    args = ["build"],
    chdir = package_name(),
    out_dirs = [".vitepress/dist"],
)

When running with the --output_base option, it fails with an error message like this one:

INFO: Found 1 target...
ERROR: /workspace/bazel_rulesjs_output_base_reprod/app/BUILD.bazel:3:20: Vitepress app/.vitepress/dist failed: (Exit 1): app__js_binary.sh failed: error executing command (from target //app:app) bazel-out/k8-opt-exec-2B5CBBC6/bin/app/app__js_binary.sh build

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
build error:
 Error: ENOENT: no such file or directory, mkdir '/workspace/bazel_rulesjs_output_base_reprod/node_modules'
    at Object.mkdirSync (node:fs:1382:3)
    at makeDir$1.makeDirSync (file:///workspace/bazel_rulesjs_output_base_reprod/buildcache/execroot/__main__/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/[email protected]/node_modules/vitepress/dist/node/serve-80cecaf0.js:8871:15)
    at Object.createSymlinkSync$1 (file:///workspace/bazel_rulesjs_output_base_reprod/buildcache/execroot/__main__/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/[email protected]/node_modules/vitepress/dist/node/serve-80cecaf0.js:9869:3)
    at linkVue (file:///workspace/bazel_rulesjs_output_base_reprod/buildcache/execroot/__main__/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/[email protected]/node_modules/vitepress/dist/node/serve-80cecaf0.js:41881:12)
    at build (file:///workspace/bazel_rulesjs_output_base_reprod/buildcache/execroot/__main__/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/[email protected]/node_modules/vitepress/dist/node/serve-80cecaf0.js:41810:21) {
  errno: -2,
  syscall: 'mkdir',
  code: 'ENOENT',
  path: '/workspace/bazel_rulesjs_output_base_reprod/node_modules'
}

Version

Development (host) and target OS/architectures:
Official bazel Docker image + fresh linux insalls where pnpm has never been run

Output of bazel --version:
bazel 6.0.0

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

1.15.0 (also happened on 1.14.0)

Language(s) and/or frameworks involved:
Vitepress

How to reproduce

I created a simple reproduction example with a one-click button to run in Gitpod.

https://github.com/rdfirtal/bazel_rulesjs_output_base_reprod

Any other information?

No response

Fund our work

  • Sponsor our open source work by donating a bug bounty
@rdfirtal rdfirtal added the bug Something isn't working label Jan 17, 2023
@gregmagolan gregmagolan moved this to 🆕 New in Open Source Feb 4, 2023
@gregmagolan gregmagolan moved this from 🆕 New to 📋 Backlog in Open Source Feb 4, 2023
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
No open projects
Status: 📋 Backlog
Development

No branches or pull requests

1 participant