--
You received this message because you are subscribed to the Google Groups "Remote Execution APIs Working Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to remote-execution...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/remote-execution-apis/6e913cf3-2c0a-47be-b63d-22a9c440219dn%40googlegroups.com.
I think this is a client-side issue (in Bazel), rather than an issue with the
remote APIs or remote caching.
Reading the linked issue, the sequence is something like:
1. bazel build //some/target --stamp --remote_cache
2. bazel clean
3. bazel build //some/target --stamp --remote_cache
You're expecting the second `build` to return the cached result of the first
build. The complaint is that Bazel is requesting rebuilds from the remote
executor that you think it shouldn't be requesting.
There's two problems here:
1. Bazel's local state contains more data than the remote/disk cache, including
data about the freshness of `volatile-status.txt`. Since this data exists
only in Bazel's local state, when you ran `bazel clean`, that data was
deleted. You were expecting it to be preserved.
2. Bazel doesn't have a way to do a "partial clean", where it deletes the data
you think it should delete, and preserves data (like volatile cache keys)
that you think it should preserve.
Since the behavior you want to change is in the client (Bazel), that seems like
it would also be the best place to investigate making changes.
Three example ideas on how to solve this on the client side:
1. Add support to Bazel for a "volatile cache", where Bazel can store data on
stamp freshness for volatile data. This would be a local path that doesn't
get cleared by `bazel clean`.
2. As part of your build, have a local-only uncached action that reads in
`volatile-status.txt` and outputs a stabilized version. This action could
do this via non-hermetic reading/writing to a local directory. Then the
stabilized volatile status gets used as an input file to the "real" action,
which executes remotely with existing cache logic.
3. Instead of using volatile status, compute equivalent data from a stable
source. For example the build timestamp might be computed from the commit
time of the revision being built, rather than the true system time.
To view this discussion on the web visit https://groups.google.com/d/msgid/remote-execution-apis/CAHg4CnHq3SaAiXWJxOCUDnO3t4rj-yBf2RAbnc8pCUEUquk4Eg%40mail.gmail.com.
I think there is a misunderstanding, or perhaps disagreement, on how stamping is supposed to work. As designed in bazel, I'd say it is by design that you don't get a remote cache hit when the volatile-status.txt file changes. The 'volatile' split is helpful to make interactive/iterative development faster, but otherwise, getting a new stamped build later is kind of expected to rerun the remote stamped actions - consider the presence of BUILD_USER / BUILD_HOST in stable-status.txt, for example.If you want to simply override the BUILD_TIMESTAMP that goes into the volatile-status.txt file so it doesn't churn your remote cache hits unduly, I think it's something like `SOURCE_DATE_EPOCH=123 bazel build ...` . https://reproducible-builds.org/docs/source-date-epoch/ has tips on how you can pick a value for it that aligns with your repo, or you could just set it to 0 or similar if you don't need the information.If what you specifically want to do is get a value embedded into the stamped binaries, but not cache invalidate on it - embed some commit the same artifact can be built from, but avoid rebuilding if another commit produces the same binary - then you're correct, that cannot be accomplished in the REAPI today. We've avoided any such feature thus far on purity/correctness grounds, but I can see your argument. Still, I suspect it'll be an uphill battle for you - e.g. other bazel users probably do want the correct CL number and build timestamp to be embedded in their binaries, so you'd be requesting a REAPI feature to support this sort of side-channel non-invalidating metadata, plus a bazel change to optionally mark the volatile-status.txt to be passed this way. I doubt that's going to be too high of a priority, so you may want to look into what workarounds you're comfortable with.