Skip to content

Consolidate JDK metadata retry handling - #1162

Merged
brunoborges merged 2 commits into
mainfrom
brunoborges-consolidate-jdk-download-retries
Jul 29, 2026
Merged

brunoborges merged 2 commits into
mainfrom
brunoborges-consolidate-jdk-download-retries

Conversation

@brunoborges

Copy link
Copy Markdown
Contributor

Description:
JavaBase previously combined automatic @actions/http-client retries 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-After support, 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:

  • Ran npm run check locally (format, lint, build, test) and all checks pass.
  • Documentation changes are not required.
  • Tests were added or updated to cover the changes.
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
Copilot AI review requested due to automatic review settings July 29, 2026 03:44
@brunoborges
brunoborges requested a review from a team as a code owner July 29, 2026 03:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 RetryingHttpClient with exponential backoff + jitter, Retry-After handling, and retry classification for common transient HTTP/network failures.
  • Updated JavaBase to 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
@brunoborges
brunoborges merged commit 5894ef6 into main Jul 29, 2026
444 checks passed
@brunoborges
brunoborges deleted the brunoborges-consolidate-jdk-download-retries branch July 29, 2026 04:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants