Migrate Zulu distribution to new metadata API with CRaC support#998
Migrate Zulu distribution to new metadata API with CRaC support#998nbauma109 wants to merge 12 commits intoactions:mainfrom
Conversation
- 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>
…ork calls Agent-Logs-Url: https://github.com/nbauma109/setup-java/sessions/22657daf-3cd6-46b6-b816-d32ff0c775e6 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>
Agent-Logs-Url: https://github.com/nbauma109/setup-java/sessions/a37adb56-8276-47ac-bd00-5e054fab3f61 Co-authored-by: nbauma109 <9403560+nbauma109@users.noreply.github.com>
Agent-Logs-Url: https://github.com/nbauma109/setup-java/sessions/442a8fd6-7118-4bd0-b4f5-a2dd028d8fcd Co-authored-by: nbauma109 <9403560+nbauma109@users.noreply.github.com>
There was a problem hiding this comment.
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/, includingjavafx_bundledandcrac_supportedquery parameters. - Added arch/OS parameter mapping helpers (e.g.,
linux→linux-glibc,x86+64→x64,arm+64→aarch64). - Updated unit tests and fixture JSON data to match the new API response schema and URL structure (including a new
jdk+cractest case).
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/distributions/zulu/models.ts | Updates the Zulu package response model to match Metadata API v1 fields. |
| src/distributions/zulu/installer.ts | Migrates version discovery to Metadata API v1, adds CRaC support and arch/OS/archive mapping + pagination. |
| dist/setup/index.js | Compiled output reflecting the updated Zulu distribution logic. |
| action.yml | Documents new supported java-package values including CRaC variants. |
| tests/distributors/zulu-installer.test.ts | Updates macOS Zulu tests for the new endpoint/params and adds a CRaC test case. |
| tests/distributors/zulu-linux-installer.test.ts | Updates Linux Zulu tests for the new endpoint/params and mapping behavior. |
| tests/distributors/zulu-windows-installer.test.ts | Updates Windows Zulu tests for the new endpoint/params and mapping behavior. |
| tests/data/zulu-releases-default.json | Updates macOS fixture data to the new response schema. |
| tests/data/zulu-linux.json | Updates Linux fixture data to the new response schema. |
| tests/data/zulu-windows.json | Updates Windows fixture data to the new response schema. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // 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}` |
There was a problem hiding this comment.
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.
| // 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); |
There was a problem hiding this comment.
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).
| // 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++; | ||
| } |
There was a problem hiding this comment.
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.
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>
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:
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:
x64instead ofx86for 64-bit, andaarch64instead ofarmfor ARM 64-bit, to match the new API's expected values.Test coverage enhancements:
jdk+cracpackage 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.