You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
### What does this PR do?
Add `**/build` to `REPO.bazel`'s `ignore_directories()`, partially replacing `.bazelignore`, and adjust `CODEOWNERS` accordingly.
### Motivation
When `bazel` runs inside a Linux container on macOS via Docker Desktop, the workspace is typically mounted on a case-insensitive filesystem where `BUILD` and `build` are indistinguishable (docker/desktop-feedback#251).
#48455 addressed this for `gazelle` by restricting it to `BUILD.bazel` files only.
Bazel's own directory traversal, however, remained exposed to the same confusion.
`REPO.bazel` gained `ignore_directories()` in Bazel **8.0** (bazelbuild/bazel#24203), introduced as a complement to `.bazelignore`
> to provide a migration path off of that weird single-purpose configuration file.
It supports Bazel's native `glob()` semantics, making `**/build` a natural fit.
Unfortunately (there's always a _but_...), it doesn't always work for symlinked directories ([example](https://gitlab.ddbuild.io/DataDog/datadog-agent/-/jobs/1544684745#L117)):
```
ERROR: infinite symlink expansion detected
[start of symlink chain]
/go/src/github.com/DataDog/datadog-agent
/go/src/github.com/DataDog/datadog-agent/.cache/bazel/_bazel_root/8595a61ca643e2561dc364b98a410786/external/_main
[end of symlink chain]
```
... which was reported here: bazelbuild/bazel#24203 (comment)
So, for the time being, we also have to keep `.bazelignore`, but shrunk down to the bare minimum, until the issue is fixed upstream.
### Additional Notes
Coming from Bazel 7, I was not aware of `REPO.bazel`, otherwise I would have added it in the first place instead of `.bazelignore` (#40153).
In `CODEOWNERS`, `/MODULE.bazel*` is replaced by `/*.bazel*` to cover `REPO.bazel` as well as any future root-level `.bazel` files.
In order to reproduce the `infinite symlink expansion detected` mentioned above, I had to configure my local `bazel` command line invocation as in CI, which surfaced the fact that `tools/bazel*` scripts had to be adjusted for this purpose. In particular, `--repo_contents_cache=` must be set when `XDG_CACHE_HOME=$PWD/.cache` (bazelbuild/bazel#26384). This is now fixed as well.
Co-authored-by: regis.desgroppes <regis.desgroppes@datadoghq.com>
0 commit comments