-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Looks like volatile-status.txt
content affects the caching key on shared cache
#16231
Comments
volatile-status.txt
content affects the caching key on remote buildvolatile-status.txt
content affects the caching key on shared cache
This is a duplicate of #10075, note in particular the discussion starting from #10075 (comment). |
I saw #10075 issue, but did not pay due attention to it, since it was closed an eternity ago - in 2019. It is especially frustrating that the local workspace and local disk caches have such different behavior. I will think about how to solve the seemingly trivial task of saving a commit, from which you can build the executable file again. With current behaviour, I should completely find and remove all |
I tried to generate a caching key without In this case looks like correct |
If you care about this, I think the next step would be to start a discussion with the Remote Execution API working group to add protocol support for it. |
The documentation should probably be updated to reflect this behavior, if it's intended, or is too fundamental to the architecture to change. "Bazel expects them to change all the time, like timestamps do, and duly updates the bazel-out/volatile-status.txt file. In order to avoid rerunning stamped actions all the time though, Bazel pretends that the volatile file never changes. In other words, if the volatile status file is the only file whose contents has changed, Bazel will not invalidate actions that depend on it. If other inputs of the actions have changed, then Bazel reruns that action, and the action will see the updated volatile status, but just the volatile status changing alone will not invalidate the action." should probably become something more like: "Like timestamps, Bazel expects them to change, and updates the bazel-out/volatile-status.txt file. To avoid rerunning stamped actions, Bazel servers pretend that the volatile file never changes. In other words, if the volatile status file is the only file whose contents have changed, a local Bazel server will ignore the new contents of volatile-status.txt unless other inputs of the actions have changed. When Bazel reruns a stamped action, the action will see the updated volatile status." to highlight the limitations of these scheme especially as they apply to solving problems like #7466 (comment). |
In my case. Stamping is an extremely useful feature that allows you to save information like "this file can be compiled from the sources of revision X" or "this file can be debug with source from revision X" without reassembling all executable files for each commit in the mono repository. But in reality it only works under the conditions:
That is, in fact, this feature does not work. For workaround I use patched bazel version: |
It should be possible to use the --experimental_remote_scrub_config flag (new in Bazel 7) to scrub volatile-status.txt from the cache key. This will only work when using a disk/remote cache with local execution, though (remote execution support, as discussed above, would require protocol changes). |
New patch version to allow use stamping with remote build for Bazel 7 (actions with stamping executes locally): |
… + build_test (#60983) `bazel build` on percy mocha targets (such as //client/web/src/integration:integration-tests) no longer result in actually running the test! Originally, we used `js_run_binary` with `build_test` as `js_test` doesnt support stamping, and we need to be able to read volatile variables for percy. Then, we worked around bazelbuild/bazel#16231 in #58505 by not explicitly depending on the stamp variables, but exploiting a bit of a hack to read them anyways (will this work with RBE?) Now, given that we're not explicitly stamping and still using the hack, we can use `js_test` instead, to avoid having the tests run as part of `bazel build`, instead only when we run `bazel test` (as is good 😌) It is apparently possible to work around bazelbuild/bazel#16231 when using disk/remote caches, but only for local builds (so no remote builds) according to [the following comment](bazelbuild/bazel#16231 (comment)), but we would still need: 1. `js_test` to support stamping and 2. this workaround to also apply to remote execution (as we're considering that once its supported in Aspect Workflows) todo: update doc/dev/background-information/bazel/web_overview.md in new docs repo ## Test plan CI 🎉
Description of the bug:
I want at the same time:
As far as I understand, if only the
volatile-status.txt
file has changed between builds, then this should not cause the application to be rebuilt.For me, changing this file is ignored only for two consecutive builds on the same working copy.
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Minimal example repository: https://github.com/bozaro/bazel-stamping
Steps for reproduce:
./stamping.sh
(this script show artifact builds difference at last step)Expected result: empty diff and exit code 0
Actual result: non-empty diff and exit code 1
What stamping.sh do?
.bazelrc:
What
stamping.sh
do:Which operating system are you running Bazel on?
Ubuntu 22.04.1 LTS
What is the output of
bazel info release
?release 5.3.0
If
bazel info release
returnsdevelopment version
or(@non-git)
, tell us how you built Bazel.No response
What's the output of
git remote get-url origin; git rev-parse master; git rev-parse HEAD
?The text was updated successfully, but these errors were encountered: