Open malt3 opened 5 months ago
Im surprised I havent had this issue (running on NixOS), I wonder am I not hitting these codepaths :thinking: we set PATH with --action_env
@Strum355 that is surprising. I created a reproducer in this branch:
https://github.com/tweag/nix_bazel_codelab/tree/malt3-esbuild-reproducer
Could you try the following instructions on NixOS?
bazel build //typescript:bundle
You should see this:
bazel build //typescript:bundle
/nix/store/3m6f30w7f6whxm6zl1m6nfr8q24p27lp-bazel-nodejs-toolchain
INFO: Analyzed target //typescript:bundle (170 packages loaded, 3100 targets configured).
ERROR: /home/malte/github.com/tweag/nix_bazel_codelab/typescript/BUILD.bazel:30:8: Bundling Javascript typescript/app.js [esbuild] failed: (Exit 127): launcher.sh failed: error executing esbuild command (from target //typescript:bundle) bazel-out/k8-opt-exec-ST-4e761c9674ba/bin/external/aspect_rules_esbuild~~esbuild~esbuild_linux-x64/launcher.sh '--esbuild_args=typescript/bundle.args.json'
Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
bazel-out/k8-opt-exec-ST-4e761c9674ba/bin/external/aspect_rules_esbuild~~esbuild~esbuild_linux-x64/launcher.sh: line 162: uname: command not found
bazel-out/k8-opt-exec-ST-4e761c9674ba/bin/external/aspect_rules_esbuild~~esbuild~esbuild_linux-x64/launcher.sh: line 483: dirname: command not found
Target //typescript:bundle failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 15.212s, Critical Path: 0.04s
INFO: 2 processes: 2 internal.
ERROR: Build did NOT complete successfully
Ah right yes, this is most likely a case of the "fallback" from the actions path patch that we've re-added locally for bazel 7 :facepalm: https://sourcegraph.com/github.com/sourcegraph/sourcegraph/-/blob/dev/nix/bazel.nix?L21-50 Im able to repro with your instructions
Aspect uses shell wrappers that invoke tools like
dirname
anduname
. When the default shell env is not inherited, this prevents tools from being found on systems without a working fallback $PATH (like NixOS).This might be incompatible with setting the env attribute, unless the bazel flag --incompatible_merge_fixed_and_default_shell_env is set on Bazel versions < 7.
See also: NixOS/nixpkgs#289505
Changes are visible to end-users: no
Test plan