Skip to content

[9.2.0] Materialize chains of symlinks in remote repos - #29959

Merged
iancha1992 merged 1 commit into
bazelbuild:release-9.2.0from
fmeum:cherry-materialize
Jun 24, 2026
Merged

iancha1992 merged 1 commit into
bazelbuild:release-9.2.0from
fmeum:cherry-materialize

Conversation

@fmeum

@fmeum fmeum commented Jun 23, 2026 •

Copy link
Copy Markdown
Collaborator

When a remotely cached repo is partially materialized since it contains action inputs, Skyframe provides the metadata of these inputs after following all symlinks as it does for all source files. Since (chains of) symlinks need to be preserved and materialized in the same way as if the repo rule ran locally or was fully materialized as a dependency of another repo rule, AbstractActionInputPrefetcher is changed to walk the full chain of symlinks behind a prefetched external repo path replant every link verbatim on the host file system.

This proves very difficult to get right for repos with symlinks pointing into the main repo as such symlinks would cross over into the host filesystem. For this reason such symlinks now exclude a repo from being cached remotely. Note that the local repo contents cache already doesn't cache such repos. Since main repo files are readily available, this is considered a minor loss in usefulness only.

Fixes #29656
Fixes #29515

RELNOTES: The remote repo contents cache now correctly materializes chains of symlinks as action inputs, but no longer supports symlinks into the main repository.

Closes #29767.

PiperOrigin-RevId: 936532134
Change-Id: I48b63f6fd2d5f57e139175e3ed578d65f6abbd08
(cherry picked from commit c310e3e)

Fixes #29816

@fmeum
fmeum requested a review from a team as a code owner June 23, 2026 10:27
@fmeum
fmeum requested a review from coeuvre June 23, 2026 10:27
@github-actions github-actions Bot added team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. team-Remote-Exec Issues and PRs for the Execution (Remote) team area-Bzlmod Bzlmod-specific PRs, issues, and feature requests awaiting-review PR is awaiting review from an assigned reviewer labels Jun 23, 2026
@fmeum
fmeum force-pushed the cherry-materialize branch from 2de3000 to 9df34d6 Compare June 23, 2026 10:42
When a remotely cached repo is partially materialized since it contains action inputs, Skyframe provides the metadata of these inputs after following all symlinks as it does for all source files. Since (chains of) symlinks need to be preserved and materialized in the same way as if the repo rule ran locally or was fully materialized as a dependency of another repo rule, `AbstractActionInputPrefetcher` is changed to walk the full chain of symlinks behind a prefetched external repo path replant every link verbatim on the host file system.

This proves very difficult to get right for repos with symlinks pointing into the main repo as such symlinks would cross over into the host filesystem. For this reason such symlinks now exclude a repo from being cached remotely. Note that the local repo contents cache already doesn't cache such repos. Since main repo files are readily available, this is considered a minor loss in usefulness only.

Fixes bazelbuild#29656
Fixes bazelbuild#29515

No

- [x] I have added tests for the new use cases (if any).
- [ ] I have updated the documentation (if applicable).

RELNOTES: The remote repo contents cache now correctly materializes chains of symlinks as action inputs, but no longer supports symlinks into the main repository.

Closes bazelbuild#29767.

PiperOrigin-RevId: 936532134
Change-Id: I48b63f6fd2d5f57e139175e3ed578d65f6abbd08
(cherry picked from commit c310e3e)
@fmeum
fmeum force-pushed the cherry-materialize branch from 9df34d6 to 3dad21f Compare June 23, 2026 12:28
@fmeum

fmeum commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator Author

@coeuvre I fixed CI failures

@iancha1992
iancha1992 added this pull request to the merge queue Jun 24, 2026
Merged via the queue into bazelbuild:release-9.2.0 with commit 4820bf6 Jun 24, 2026
45 checks passed
@github-actions github-actions Bot removed the awaiting-review PR is awaiting review from an assigned reviewer label Jun 24, 2026
aherrmann added a commit to yume-ag/bviz that referenced this pull request Sep 30, 2026
With --experimental_remote_repo_contents_cache, Bazel 9.0.1 caches only
repositories whose marker file records nothing beyond the predeclared
inputs hash; a repository that records further inputs while it is
fetched is skipped, so it is refetched on every clean start. That
covers the crate repositories that read the crates index, patched
repositories, and http_archive with a build_file label. Bazel 9.1.0
extends the cache to all reproducible repository rules
(bazelbuild/bazel#29225). Bazel 9.2.0 fixes symlink handling in the
cache but excludes repositories with symlinks into the main repository
or into other repositories (bazelbuild/bazel#29959, #30190), such as
the llvm runtime source repositories and the ztracing crate; those are
still fetched on every clean start.

The lockfile moves to format version 28 and picks up rules_java 9.1.0
through bazel_tools.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-Bzlmod Bzlmod-specific PRs, issues, and feature requests team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. team-Remote-Exec Issues and PRs for the Execution (Remote) team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants