Skip to content

Conversation

@trevorgray
Copy link
Contributor

#515 only makes the config repository reproducible. The downloaded toolchains are store in a separate repository. Since this separate repository is not marked as reproducible, the extracted files are currently not cached.

This change fixes that by marking the repositority that contains the downloaded toolchain also reproducible.

Similar to the git repo rule here: https://github.com/bazelbuild/bazel/blob/648f991bd8653408ba6b4c24c6ff8fa4fce51eba/tools/build_defs/repo/git.bzl#L219

@fmeum fmeum enabled auto-merge (squash) August 6, 2025 12:41
auto-merge was automatically disabled August 6, 2025 15:19

Head branch was pushed to by a user without write access

@trevorgray
Copy link
Contributor Author

Fixed the missing attr_dict import which I missed when copying the changes to this branch.

@fmeum fmeum enabled auto-merge (squash) August 6, 2025 20:29
@fmeum
Copy link
Member

fmeum commented Aug 7, 2025

A bunch of CI jobs are failing due to increased disk usage. Did you see any of that in your local testing? I wouldn't have expected disk usage to change since the repo cache moves extracted dirs.

@trevorgray
Copy link
Contributor Author

trevorgray commented Aug 7, 2025

The extracted data gets put into the repo cache but then the data is copied to the external directory as normally would happen. They aren't moved out of the repo cache or hardlinked. This change just prevents re-downloading and extracting them each time.

You can set --experimental_repository_cache_hardlinks to hardlink the files which is suppose to fix the copying issue but I've tried setting this and the files were still copied.

@fmeum
Copy link
Member

fmeum commented Aug 7, 2025

That's true for the repository cache, but shouldn't be the case for the new repo contents cache. It does move the directory and then symlinks to it: https://cs.opensource.google/bazel/bazel/+/f03468522dac6a2e5989ee13cdd540de9349c195:src/main/java/com/google/devtools/build/lib/bazel/repository/cache/RepoContentsCache.java;l=174

@trevorgray
Copy link
Contributor Author

Yes. You are right. I was looking inside the llvm tools repo directory so I did not see the symlink since it was symlinking the whole directory and not the individual files.

@trevorgray
Copy link
Contributor Author

trevorgray commented Aug 7, 2025

# WebAssembly tests use a separate (newer) version of LLVM to exercise support

WebAssembly tests use a separate (newer) version of LLVM to exercise support for experimental features such as wasm64, which can cause the CI environment to run out of disk space. Mitigate this by expunging the workspace before trying to build Wasm targets.

So the problem is that when you run bazel clean --expunge, the command doesn't clean out the repo cache. Before the llvm toolchains were being cleaned since they were in the work tree. Now they are in the repo cache and not the work tree. The fix seems to be to just delete the repo cache before running those tests right after the bazel clean

auto-merge was automatically disabled August 7, 2025 13:51

Head branch was pushed to by a user without write access

@trevorgray trevorgray requested a review from fmeum August 11, 2025 20:35
Copy link
Member

@fmeum fmeum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks for digging!

@fmeum fmeum enabled auto-merge (squash) August 11, 2025 21:05
auto-merge was automatically disabled August 11, 2025 21:46

Head branch was pushed to by a user without write access

@trevorgray
Copy link
Contributor Author

I've updated the code to fix missing $USER variable on some variants of linux. I've also updated the path on mac os since apparently it's different (https://bazel.build/remote/output-directories)

@trevorgray trevorgray requested a review from fmeum August 11, 2025 22:33
@fmeum fmeum enabled auto-merge (squash) August 12, 2025 06:12
@fmeum fmeum merged commit d103be7 into bazel-contrib:master Aug 12, 2025
36 checks passed
helly25 pushed a commit to helly25/bazel-toolchain that referenced this pull request Sep 28, 2025
bazel-contrib#515 only makes the config repository reproducible. The downloaded
toolchains are store in a separate repository. Since this separate
repository is not marked as reproducible, the extracted files are
currently not cached.

This change fixes that by marking the repositority that contains the
downloaded toolchain also reproducible.

Similar to the git repo rule here:
https://github.com/bazelbuild/bazel/blob/648f991bd8653408ba6b4c24c6ff8fa4fce51eba/tools/build_defs/repo/git.bzl#L219
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants