fix: retry sdkmanager install on transient download failures - #81
Merged
Conversation
sdkmanager has no download retry. A truncated download from dl.google.com (seen in the PR #80 JDK 17 build as "An error occurred while preparing SDK package CMake 3.22.1: Archive is not a ZIP archive") fails the whole image build even though the Dockerfile is fine. sdkmanager is idempotent, so wrap the install in an until-loop that retries up to 3 times, clearing the SDK's .temp download dir between attempts so a corrupt partial archive is not reused. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012jviQGmp5ey58RmYqoPssC
There was a problem hiding this comment.
🟢 Approval recommended
The retry loop is bounded, preserves failure behavior after 3 attempts, and the change is localized to the intended sdkmanager install step.
Pull request overview
This PR improves the reliability of Android SDK component installation during image builds by adding a retry mechanism around sdkmanager to handle transient/truncated downloads from dl.google.com.
Changes:
- Wraps the
sdkmanagerpackage install step in anuntilloop with up to 3 attempts and 15s backoff. - Clears the SDK’s temporary download directory between attempts to avoid reusing corrupted partial downloads.
- Emits explicit retry/failure messages and fails the build after the final attempt.
File summaries
| File | Description |
|---|---|
Dockerfile |
Adds a bounded retry loop around sdkmanager installs and clears .temp between retries to mitigate transient download truncations. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Why
PR #80's
Build JDK 17job failed with:The download from
dl.google.comwas truncated andsdkmanagertried to unzip the partial file. The same package installed fine in the JDK 21 job of the same run, so this was a network flake — butsdkmanagerhas no built-in download retry, so one bad download fails the whole image build.What
Wrap the
sdkmanagerinstallRUNin anuntilloop that retries up to 3 times (15s apart).sdkmanageris idempotent — already-installed packages are skipped — so re-running the whole command is safe. The SDK's.tempdownload scratch dir is cleared between attempts so a corrupt partial archive isn't reused. After 3 failures the build still fails loudly withsdkmanager failed after 3 attempts.Verification
bash -o pipefailagainst a mocksdkmanager:docker build --check .→ no warningsdocker build --target android .succeeded;cmake/3.22.1,ndk/29.0.14206865,build-tools/37.0.0,platforms/android-36.1, andplatform-toolsall present in the resulting image.🤖 Generated with Claude Code
https://claude.ai/code/session_012jviQGmp5ey58RmYqoPssC