Skip to content

fix(scripts): keep Robolectric's jar between remote test runs so Maven Central stops rate-limiting us - #102

Merged
GeiserX merged 2 commits into
mainfrom
fix/remote-gradle-m2-cache
Nov 7, 2026
Merged

GeiserX merged 2 commits into
mainfrom
fix/remote-gradle-m2-cache

Conversation

@GeiserX

@GeiserX GeiserX commented Nov 7, 2026 •

Copy link
Copy Markdown
Owner

scripts/remote-gradle.sh starts a fresh eclipse-temurin container for every run and keeps only sdk/ and gradle/ on the build host. Robolectric fetches its android-all jar (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/m2 at /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 lists m2/ with the other folders.

Checked by running remote-gradle.sh testDebugUnitTest --tests '*IconGoldenTest*' against a build root whose m2/ 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 /tmp is 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 sets JAVA_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.

@coderabbitai

coderabbitai Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 71e3bc7 and b39812e.

Files selected for processing: 1

  • scripts/remote-gradle.sh
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@GeiserX
GeiserX merged commit e25b2df into main Nov 7, 2026
5 checks passed
@GeiserX
GeiserX deleted the fix/remote-gradle-m2-cache branch November 7, 2026 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant