Repository navigation
fix(scripts): stage Robolectric's download inside the cache so a killed build cannot leave a truncated jar - #103
Merged
Conversation
…ed build cannot leave a truncated jar
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 21 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
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.
Follow-up to #102, which merged before this landed.
Robolectric downloads its
android-alljar intojava.io.tmpdir, checks the SHA-512, then moves it into/root/.m2. Inside the build container,/tmpis a different filesystem from the mounted cache, so that move is a copy. A container stopped mid-copy leaves a truncated jar in the cache, and every later run trusts it because the file exists.scripts/remote-gradle.shnow setsJAVA_TOOL_OPTIONS=-Djava.io.tmpdir=/root/.m2/tmpand creates that folder. The staging dir then sits on the same filesystem as the cache, so the move is a rename: the jar is either complete or absent.Checked on a build host with an empty cache, serving the jar from a local mirror (
robolectric.dependency.repo.url, used for the check only, because Maven Central was answering 429). Both runs downloaded the jar and ended with all 151,142,227 bytes and a matching SHA-512, andIconGoldenTestpassed (5 tests). Without the change, the staging dir was on a different device from the cache (58720430 vs 57), so the move was a copy. With it, both were on device 57, so the move was a rename.Only the developer script changes. CI, the app and the F-Droid build don't use it.