Fix non-deterministic properties.jar causing (remote) cache misses fo…#475
Open
oliviernotteghem wants to merge 1 commit intobazelbuild:mainfrom
Open
Fix non-deterministic properties.jar causing (remote) cache misses fo…#475oliviernotteghem wants to merge 1 commit intobazelbuild:mainfrom
oliviernotteghem wants to merge 1 commit intobazelbuild:mainfrom
Conversation
…r Robolectric tests
Robolectric tests in android_local_test rules produce a properties.jar archive containing test_config.properties. This jar is an input to the TestRunner action, so its SHA-256 hash is part of the remote cache key.
On CI, TestRunner consistently missed the remote cache even when nothing had changed.
In rules/android_local_test/impl.bzl, the _zip_file helper stages the file before zipping:
cp $base/{f} {dir_name}
zip -jt -X -q $base/{out_zip} {dir_name}/$(basename {f})
Because cp is used without -p, it resets the file's mtime to the current time. The zip tool embeds this timestamp into the archive.
As a result, two CI agents produce properties.jar files with identical content but different timestamps → different SHA-256 → cache miss.
Use `cp -p` to preserve the original mtime.
This makes the zip output deterministic across agents and stabilizes the TestRunner cache key.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…r Robolectric tests
Robolectric tests in android_local_test rules produce a properties.jar archive containing test_config.properties. This jar is an input to the TestRunner action, so its SHA-256 hash is part of the remote cache key.
On CI, TestRunner consistently missed the remote cache even when nothing had changed.
In rules/android_local_test/impl.bzl, the _zip_file helper stages the file before zipping:
Because cp is used without -p, it resets the file's mtime to the current time. The zip tool embeds this timestamp into the archive. Note that zip -X does not reset mtime (which is the problem here).
As a result, two CI agents produce properties.jar files with identical content but different timestamps → different SHA-256 → cache miss.
Use
cp -pto preserve the original mtime of file, which is deterministic (because file is created by starlark ctx.actions.expand_template method)This makes the zip output deterministic across agents and stabilizes the TestRunner cache key.