Repository navigation
fix(scripts): keep Robolectric's jar between remote test runs so Maven Central stops rate-limiting us - #102
Merged
Merged
Conversation
…n Central stops rate-limiting us
|
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 26 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.
scripts/remote-gradle.shstarts a fresheclipse-temurincontainer for every run and keeps onlysdk/andgradle/on the build host. Robolectric fetches itsandroid-alljar (about 150 MB) through Maven into/root/.m2, which lives inside the container and is gone after each run. So every test run downloads the jar again, and after a few runs Maven Central starts answering with HTTP 429 and the tests can't start.The fix mounts
$CASHPILOT_BUILD_ROOT/m2at/root/.m2, next to the existing Gradle cache. Docker creates the folder on first use, so existing build roots need no setup step. The header comment listsm2/with the other folders.Checked by running
remote-gradle.sh testDebugUnitTest --tests '*IconGoldenTest*'against a build root whosem2/already held the jar. The Robolectric tests ran with no download and the build passed.Only the developer script changes. CI, the app and the F-Droid build don't use it.
Atomic install of the jar
Robolectric downloads into
java.io.tmpdir, checks the SHA-512, then moves the jar into/root/.m2. The container's/tmpis a different filesystem from the mounted cache, so that move is a copy. A container stopped mid-copy leaves a truncated jar, and every later run trusts it because the file exists. The script now setsJAVA_TOOL_OPTIONS=-Djava.io.tmpdir=/root/.m2/tmp, so the staging dir sits on the same filesystem as the cache and 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. 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.