Consolidate JDK metadata retry handling - #1162
Merged
Merged
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: a5e2549a-0d89-4c8f-b7f3-411ad21c8a06
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: a5e2549a-0d89-4c8f-b7f3-411ad21c8a06
Contributor
There was a problem hiding this comment.
Pull request overview
This PR consolidates JDK metadata retry behavior into a single, bounded retrying HTTP client to avoid multiplying requests and repeating version resolution, while keeping archive downloads handled by @actions/tool-cache’s download logic.
Changes:
- Added
RetryingHttpClientwith exponential backoff + jitter,Retry-Afterhandling, and retry classification for common transient HTTP/network failures. - Updated
JavaBaseto use the shared retrying client and removed the installer-level retry loop (including private console timer access). - Added/updated tests to validate retry behavior (including deterministic 429/Retry-After coverage) and ensured all distributions share the client; expanded E2E matrix to include Oracle OpenJDK.
Show a summary per file
| File | Description |
|---|---|
| src/retrying-http-client.ts | Introduces a bounded retrying HTTP client (backoff/jitter + Retry-After) for metadata requests. |
| src/distributions/base-installer.ts | Switches installers to the shared retrying client and removes the outer retry loop; centralizes error logging. |
| dist/setup/index.js | Bundled output updated to include the new retry client and installer changes. |
| .github/workflows/e2e-versions.yml | Extends E2E matrix coverage to include oracle-openjdk across OSes. |
| tests/retrying-http-client.test.ts | Adds unit tests for retry backoff/jitter, Retry-After parsing/capping, and retry classification. |
| tests/distributors/jetbrains-installer.test.ts | Adds deterministic 429 + Retry-After retry test for JetBrains metadata calls. |
| tests/distributors/distribution-factory.test.ts | Verifies each distribution uses the shared RetryingHttpClient. |
| tests/distributors/base-installer.test.ts | Ensures version resolution isn’t repeated when downloadTool fails. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 7/8 changed files
- Comments generated: 0
- Review effort level: Low
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.
Description:
JavaBasepreviously combined automatic@actions/http-clientretries with a broad installer-level retry loop, multiplying metadata requests and repeating successful version resolution when downloads failed.This change introduces one bounded retrying client for metadata requests with exponential backoff, jitter,
Retry-Aftersupport, and the existing HTTP/network retry classifications. It removes the installer retry loop and private console timer access. Archive transfers continue to use@actions/tool-cache.downloadTool, preserving toolkit streaming, proxy, cleanup, and download retry behavior without wrapping it in another setup-java retry.The distribution coverage verifies every remote distribution uses the shared client, adds a deterministic JetBrains 429 test, and extends the live E2E matrix to Oracle OpenJDK. The dispatched matrix completed all 368 jobs successfully, including 30 JetBrains scenarios.
Related issue:
Fixes: #1155
Check list:
npm run checklocally (format, lint, build, test) and all checks pass.