facebook / facebook/buck2

Should `allow_cache_upload` be available on more rules?

Open
#478 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
4.4k
Forks
394
PR merge metrics
No merged PRs in 30d

Description

As far as I can tell, the allow_cache_upload flag is available only on 3 specific binary rules, and nowhere else. allow_cache_upload is also default False on every actions.run() call, so there are probably a hundred places in prelude that have yet to get it threaded through. If that was ever the goal.

Available:
- python_binary
- cxx_binary
- rust_binary

Not available, for example:
- cxx_library
- rust_library
- rust_test

There's obviously some rhyme to this, in that somebody committed those three `| buck.allow_cache_upload_arg()` attributes only on binary rules, but I can't find a rationale. I have a few guesses:

- Cache uploads have just not been used much, given they do not work yet in OSS (pending #477). Don't know what happens at Meta. Maybe it's RE all the way, and never keep a local build.
- Maybe RE backends are always able to push and pull from the cache no matter what local buckd instances do, so nobody cares about local builds?
- Conservatively enabling for only binary builds papers over any issues with uploading local action results that might not work on other machines. Binaries are more likely to be portable if you used a slightly different compiler or linked to a different shared library version. We just don't trust local execution or the exhaustiveness of hidden dependency inclusion (to cache-bust different configurations) enough to enable it.

I just quickly patched prelude to enable it on rust_library and supply it in the macro reindeer calls for all crates.io targets, and it seems to work great. You can launch another buckd on a separate isolation dir on a big crate graph that reindeer made, and it eats it for breakfast.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.