Symlink failure if `bazel-bin` cleaned between bazel runs, RBE enabled
- Dominant language
- Java
- Stars
- 25.8k
- Forks
- 4.6k
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 72
Description
### Description of the bug:
We have some pipelines that clear bazel-bin between runs to save some space. It worked for long time, but fails in corner case in RBE when `go_library` is used by `sh_test` within `srcs` attribute. Failure from simple reproduction below:
```
ERROR: /tmp/bazel-symlink-clean-issue/BUILD.bazel:15:8: Symlinking //:c failed: 'bazel-out/k8-fastbuild/bin/subdir/a' is not a file
```
### Which category does this issue belong to?
Remote Execution
### What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
FIrst, start RBE, e.g. built-in like below.
```bash
USE_BAZEL_VERISON=7.6.1 bazelisk build src/tools/remote:all
bazel-bin/src/tools/remote/worker --work_path=/tmp/bazel-worker/work --cas_path=/tmp/bazel-worker/cas --listen_port=8080
```
Then execute below script:
```bash
#!/bin/bash
set -e
set -x
# NOTE: Reproduction fails for all below versions
# export USE_BAZEL_VERSION=7.6.1
export USE_BAZEL_VERSION=8.3.1
# export USE_BAZEL_VERSION=last_green
BAZEL=bazelisk
TEST_OPTS="--remote_executor=grpc://localhost:8080"
# NOTE: Using download all fixes issue
# TEST_OPTS="--remote_download_all --remote_executor=grpc://localhost:8080"
echo "------------------------------------------- Prepare repo ----------------------------"
rm -rf /tmp/bazel-symlink-clean-issue
mkdir /tmp/bazel-symlink-clean-issue
cd /tmp/bazel-symlink-clean-issue
cat > MODULE.bazel < BUILD.bazel <
Contributor guide
Assessment
This issue has not been assessed yet.