Skip to content

Migrate Zulu distribution to new metadata API with CRaC support - #998

Closed
nbauma109 wants to merge 12 commits into
actions:mainfrom
nbauma109:claude/allow-differentiating-zulu-releases
Closed

Migrate Zulu distribution to new metadata API with CRaC support#998
nbauma109 wants to merge 12 commits into
actions:mainfrom
nbauma109:claude/allow-differentiating-zulu-releases

Conversation

@nbauma109

Copy link
Copy Markdown

Fixes#636

This pull request updates the test cases for the Zulu installer across macOS, Linux, and Windows to reflect changes in the URL structure and parameter mapping for the Azul Zulu API. The main focus is on aligning the tests with the new API endpoint and parameter conventions, as well as updating architecture mappings to match the latest standards.

API endpoint and parameter updates:

  • All test cases now use the new https://api.azul.com/metadata/v1/zulu/packages/ endpoint instead of the old /zulu/download/community/v1.0/bundles/ endpoint, and update URL parameters to match the new API specification (e.g., archive_type, java_package_type, javafx_bundled, crac_supported, availability_types, certifications, pagination, etc.). [1][2][3][4][5][6][7][8][9]

Architecture and parameter mapping improvements:

  • Architecture mapping is updated: test cases now use x64 instead of x86 for 64-bit, and aarch64 instead of arm for ARM 64-bit, to match the new API's expected values.
  • Test cases now include logic for mapping architecture names based on bitness and architecture, improving accuracy for different platforms. [1][2]

Test coverage enhancements:

  • Added a new test case for the jdk+crac package type, ensuring that CRaC (Coordinated Restore at Checkpoint) support is correctly handled in the URL parameters.

Consistency and completeness:

Overall, these changes ensure that the Zulu installer tests are up-to-date with the latest Azul Zulu API and accurately reflect the new parameter and architecture conventions.

ClaudeAIand others added 10 commits April 3, 2026 20:40
- Updated IZuluVersions model to match new API response structure
- Migrated from old bundles API to new metadata API v1
- Added CRaC support with jdk+crac and jre+crac package types
- Set crac_supported=false by default to avoid selecting CRaC builds
- Updated all test files and test data for new API format
- Added test coverage for CRaC package type
- Updated action.yml to document new CRaC package types
Agent-Logs-Url: https://github.com/nbauma109/setup-java/sessions/50830dca-2522-43f9-befd-3285589dac71
Co-authored-by: nbauma109 <9403560+nbauma109@users.noreply.github.com>
Removed unused archParam variable that always returned arch regardless of condition. The new metadata API doesn't use hw_bitness parameter, so arch is used directly.
Agent-Logs-Url: https://github.com/nbauma109/setup-java/sessions/defb7621-9c39-4bcc-a345-2eb4f3447e39
Co-authored-by: nbauma109 <9403560+nbauma109@users.noreply.github.com>
…lu metadata API
- Add pagination logic to fetch all available packages instead of just first 100
- Add getArchParam() method to correctly map architecture values (x64, x86, arm64, arm)
- Update tests to expect correct architecture parameters in API URLs
Agent-Logs-Url: https://github.com/nbauma109/setup-java/sessions/b138d8c7-38d8-473f-b525-5b0eebc89962
Co-authored-by: nbauma109 <9403560+nbauma109@users.noreply.github.com>
- Conditional TCK certification filter: only apply certifications=tck to GA releases, not EA
- Change ARM 64-bit arch parameter from arm64 to aarch64 to match API expectations
- Update tests to reflect these changes (EA URLs no longer have certifications=tck, ARM64 uses aarch64)
Agent-Logs-Url: https://github.com/nbauma109/setup-java/sessions/fd061273-f16e-4ec7-9790-3b46d7823528
Co-authored-by: nbauma109 <9403560+nbauma109@users.noreply.github.com>
…omit certifications=tck
Agent-Logs-Url: https://github.com/nbauma109/setup-java/sessions/b06a25de-1827-421b-8c61-19ef01493322
Co-authored-by: nbauma109 <9403560+nbauma109@users.noreply.github.com>
…t.net is whitelisted
Agent-Logs-Url: https://github.com/nbauma109/setup-java/sessions/74ae64af-1192-420c-8c3e-aefa09bfb00a
Co-authored-by: nbauma109 <9403560+nbauma109@users.noreply.github.com>
@nbauma109
nbauma109 requested a review from a team as a code ownerApril 4, 2026 10:06
CopilotAI review requested due to automatic review settings April 4, 2026 10:06

CopilotAI 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 migrates the Zulu distribution implementation and related tests from Azul’s legacy “community bundles” API to the newer Metadata API v1, enabling explicit CRaC vs non-CRaC selection and updating platform/arch/query parameter conventions.

Changes:

  • Switched Zulu version discovery to https://api.azul.com/metadata/v1/zulu/packages/, including javafx_bundled and crac_supported query parameters.
  • Added arch/OS parameter mapping helpers (e.g., linuxlinux-glibc, x86+64x64, arm+64aarch64).
  • Updated unit tests and fixture JSON data to match the new API response schema and URL structure (including a new jdk+crac test case).

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 4 comments.

Show a summary per file
FileDescription
src/distributions/zulu/models.tsUpdates the Zulu package response model to match Metadata API v1 fields.
src/distributions/zulu/installer.tsMigrates version discovery to Metadata API v1, adds CRaC support and arch/OS/archive mapping + pagination.
dist/setup/index.jsCompiled output reflecting the updated Zulu distribution logic.
action.ymlDocuments new supported java-package values including CRaC variants.
tests/distributors/zulu-installer.test.tsUpdates macOS Zulu tests for the new endpoint/params and adds a CRaC test case.
tests/distributors/zulu-linux-installer.test.tsUpdates Linux Zulu tests for the new endpoint/params and mapping behavior.
tests/distributors/zulu-windows-installer.test.tsUpdates Windows Zulu tests for the new endpoint/params and mapping behavior.
tests/data/zulu-releases-default.jsonUpdates macOS fixture data to the new response schema.
tests/data/zulu-linux.jsonUpdates Linux fixture data to the new response schema.
tests/data/zulu-windows.jsonUpdates Windows fixture data to the new response schema.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +120 to +140
// Fetch all pages to avoid missing packages when there are > 100 results
let allVersions: IZuluVersions[] = [];
let page = 1;
const pageSize = 100;
let hasMore = true;

while (hasMore) {
const requestArguments = [
`os=${osParam}`,
`arch=${archParam}`,
`archive_type=${archiveType}`,
`java_package_type=${bundleType}`,
`javafx_bundled=${javafx}`,
`crac_supported=${crac}`,
`release_status=${releaseStatus}`,
`availability_types=ca`,
// Only filter by TCK certification for GA releases
// EA releases typically don't have TCK certification
releaseStatus === 'ga' ? `certifications=tck` : '',
`page=${page}`,
`page_size=${pageSize}`

CopilotAIApr 4, 2026

Copy link

Choose a reason for hiding this comment

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

The new metadata API query does not include any java_version/latest filtering, and the implementation paginates until exhaustion. This can result in many HTTP requests and large responses (slow installs, higher chance of rate limiting). Consider constraining the request using the requested version range (e.g., set java_version based on the range’s major when possible, and/or use latest=true for common ranges like 21/21.x) so you don’t need to fetch every historical release.

Copilot uses AI. Check for mistakes.
Comment thread__tests__/data/zulu-windows.json Outdated
Comment on lines +115 to +118
// Map old API parameters to new metadata API parameters
const osParam = this.getOsParam(platform);
const archiveType = this.getArchiveType(extension);
const archParam = this.getArchParam(arch, hw_bitness);

CopilotAIApr 4, 2026

Copy link

Choose a reason for hiding this comment

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

The function still destructures abi from getArchitectureOptions() but it’s no longer used anywhere in this method after the metadata API migration. With @typescript-eslint/no-unused-vars enabled for src/, this will fail lint. Remove abi from the destructuring (or use it in the request if it’s required for some platforms).

Copilot uses AI. Check for mistakes.
Comment on lines +120 to +158
// Fetch all pages to avoid missing packages when there are > 100 results
let allVersions: IZuluVersions[] = [];
let page = 1;
const pageSize = 100;
let hasMore = true;

while (hasMore) {
const requestArguments = [
`os=${osParam}`,
`arch=${archParam}`,
`archive_type=${archiveType}`,
`java_package_type=${bundleType}`,
`javafx_bundled=${javafx}`,
`crac_supported=${crac}`,
`release_status=${releaseStatus}`,
`availability_types=ca`,
// Only filter by TCK certification for GA releases
// EA releases typically don't have TCK certification
releaseStatus === 'ga' ? `certifications=tck` : '',
`page=${page}`,
`page_size=${pageSize}`
]
.filter(Boolean)
.join('&');

const availableVersionsUrl = `https://api.azul.com/metadata/v1/zulu/packages/?${requestArguments}`;

core.debug(`Gathering available versions from '${availableVersionsUrl}'`);

const pageResults =
(await this.http.getJson<Array<IZuluVersions>>(availableVersionsUrl))
.result ?? [];

allVersions = allVersions.concat(pageResults);

// If we got fewer results than page size, we've reached the end
hasMore = pageResults.length === pageSize;
page++;
}

CopilotAIApr 4, 2026

Copy link

Choose a reason for hiding this comment

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

Pagination logic (while (hasMore), page, page_size) is new behavior but current unit tests only assert a single getJson call. Add a test that simulates multiple pages (e.g., first response length === pageSize, second shorter) and asserts multiple requests + correct concatenation, to prevent regressions/infinite-loop bugs.

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…cument CRaC in README
Agent-Logs-Url: https://github.com/nbauma109/setup-java/sessions/50c422d6-fd37-4e0b-a22c-a3745f876e7b
Co-authored-by: nbauma109 <9403560+nbauma109@users.noreply.github.com>
@brunoborgesbrunoborges added feature request New feature or request to improve the current logic distribution JDK distribution/version/source support labels Jun 22, 2026
@brunoborges

brunoborges commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Closing this in favor of #1010 to keep the Azul Metadata API migration scoped and reviewable.

Both PRs move Zulu from the deprecated Discovery API to the Metadata API, but #998 also bundles additional changes (for example CRaC/supporting docs/action metadata/dist updates). To reduce merge risk and speed up the core migration, we will proceed with the narrower migration path first, then follow up with any additional improvements in a separate PR if needed.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

distributionJDK distribution/version/source supportfeature requestNew feature or request to improve the current logic

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow differentiating Zulu releases with/without CRaC

5 participants

@nbauma109@brunoborges@Claude