Skip to content

Migrate from Zulu Discovery API to Azul Metadata API#1010

Open
jameswald wants to merge 5 commits into
actions:mainfrom
jameswald:azul-metadata-api
Open

Migrate from Zulu Discovery API to Azul Metadata API#1010
jameswald wants to merge 5 commits into
actions:mainfrom
jameswald:azul-metadata-api

Conversation

@jameswald
Copy link
Copy Markdown

@jameswald jameswald commented May 29, 2026

Used Claude Sonnet 4.6 to implement https://docs.azul.com/core/detailed/metadata-api-migration.html. If it's way off the mark then we can close it but if it's salvageable then please feel free to push any necessary commits on top of what is already done.

Summary

Migrates the zulu distribution from the deprecated Zulu Discovery API (https://api.azul.com/zulu/download/community/v1.0/bundles/) to the new Azul Metadata API (https://api.azul.com/metadata/v1/zulu/packages/).

Background

The old Zulu Discovery API was returning HTTP 520 errors for a few hours, breaking all distribution: zulu workflows. Since the beginning of 2023 Azul has recommended the Metadata API and published a migration guide.

Changes

src/distributions/zulu/models.ts

Updated IZuluVersions to match the new API response shape:

  • id: numberpackage_uuid: string
  • urldownload_url
  • jdk_versionjava_version
  • zulu_versiondistro_version
  • Added latest: boolean and availability_type: string

src/distributions/zulu/installer.ts

  • New API base URL: https://api.azul.com/metadata/v1/zulu/packages/
  • Renamed query parameters: extarchive_type, bundle_typejava_package_type, javafxjavafx_bundled
  • Removed hw_bitness and abi query parameters (no longer part of the API)
  • Added availability_types=ca to restrict to free community builds
  • Pagination: the new API is paginated; added a loop that iterates through all pages until an empty page is returned
  • Simplified getArchitectureOptions(): now returns a plain string instead of {arch, hw_bitness, abi}. Architecture mapping: x64x64, x86x86, arm64/aarch64aarch64
  • Linux platform: returns linux_glibc instead of linux to exclude musl packages, which standard GitHub-hosted runners do not use
  • Fixed a typo: win_aarhc4win_aarch64

README.md

Updated the architecture-mapping note to reflect the new API's conventions (arm64aarch64).

Test fixtures and tests

  • Updated all three fixture files (zulu-releases-default.json, zulu-linux.json, zulu-windows.json) to use the new field names
  • Updated URL assertions in all three installer test files to match the new endpoint and parameter names
  • Updated getArchitectureOptions test cases to expect strings instead of objects
  • Removed the DistroArch type (no longer needed)

Related issue

Fixes #795

Check list

  • Documentation updated (README.md)
  • Tests added/updated to cover the changes

@jameswald jameswald marked this pull request as ready for review May 29, 2026 00:46
@jameswald jameswald requested a review from a team as a code owner May 29, 2026 00:46
Copilot AI review requested due to automatic review settings May 29, 2026 00:46
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Migrates the Zulu (Azul) distribution from the deprecated zulu/download/community/v1.0 API to the new metadata/v1/zulu/packages API, updating request parameters, response model fields, and architecture mapping accordingly.

Changes:

  • Switched API endpoint and renamed query parameters (e.g., extarchive_type, bundle_typejava_package_type, javafxjavafx_bundled); replaced hw_bitness/abi with a single arch value and added availability_types, page, page_size parameters.
  • Updated IZuluVersions model to use new field names (package_uuid, download_url, java_version, distro_version, latest, availability_type).
  • Updated tests and fixture data to align with the new API contract; updated README note about arch mapping.

Reviewed changes

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

Show a summary per file
File Description
src/distributions/zulu/models.ts Updated IZuluVersions interface to new Azul Metadata API schema.
src/distributions/zulu/installer.ts Updated request URL/params, response field references, and simplified getArchitectureOptions to return a single string.
tests/distributors/zulu-installer.test.ts Updated expected URLs and arch mapping assertions for macOS.
tests/distributors/zulu-linux-installer.test.ts Updated expected URLs and arch mapping for Linux.
tests/distributors/zulu-windows-installer.test.ts Updated expected URLs and arch mapping for Windows.
tests/data/zulu-windows.json Regenerated fixture to match new API response schema.
tests/data/zulu-linux.json Regenerated fixture to match new API response schema.
tests/data/zulu-releases-default.json Regenerated fixture to match new API response schema.
README.md Updated note about Zulu architecture mapping.

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

Comment on lines +111 to +119
`archive_type=${extension}`,
`java_package_type=${bundleType}`,
`javafx_bundled=${javafx}`,
`arch=${arch}`,
`hw_bitness=${hw_bitness}`,
`release_status=${releaseStatus}`,
abi ? `abi=${abi}` : null,
features ? `features=${features}` : null
]
.filter(Boolean)
.join('&');
`availability_types=ca`,
`page=1`,
`page_size=1000`
].join('&');
Copy link
Copy Markdown
Author

@jameswald jameswald May 29, 2026

Choose a reason for hiding this comment

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

This is beyond me so here's what Claude output in response to this comment:

⏺ The live API response tells the full story. All 5 results with javafx_bundled=true have -fx- in their filenames (e.g., zulu26.30.11-ca-fx-jdk26.0.1-linux_x64.tar.gz), confirming the filter works correctly.

The Copilot comment is not a legitimate issue. Here's why:

The reviewer is applying old-API logic to the new API. In the old API (/zulu/download/community/v1.0/bundles/), you needed two separate parameters to get JavaFX bundles:

  • javafx=true
  • features=fx

In the new Metadata API (/metadata/v1/zulu/packages/), javafx_bundled is a dedicated, purpose-built boolean field that directly filters for JavaFX-bundled packages — it's not an alias for javafx; it's an entirely different parameter on a different API. The live API confirms: passing javafx_bundled=true returns only packages whose names contain -fx-.

There's no features parameter on the new Metadata API at all — it's not just that we dropped it, it doesn't exist in the new API. Adding features=fx to the new URL would likely be ignored or cause an error.

The tests were correctly updated to match the new API's behavior, not to hide a regression.

Comment thread src/distributions/zulu/installer.ts Outdated
Comment on lines +116 to +119
`availability_types=ca`,
`page=1`,
`page_size=1000`
].join('&');
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Implemented with d9458f0.

src/distributions/zulu/installer.ts

  • Replaced the single page=1&page_size=1000 request with an infinite loop starting at page=1
  • Each iteration requests page_size=100 entries; the loop breaks when the API returns an empty array
  • Matches the pattern already used by the Adopt distribution, adapted for Azul's 1-based page indexing

Three test files (zulu-installer.test.ts, zulu-windows-installer.test.ts, zulu-linux-installer.test.ts)

  • Changed the beforeEach default mock to return [] so URL verification tests terminate the loop after one call
  • Updated load available versions in each file to use mockReturnValueOnce(data) followed by mockReturnValueOnce([]) to simulate a single full page then end-of-pagination
  • Updated all URL string expectations from page_size=1000 to page_size=100

Comment thread __tests__/data/zulu-windows.json Outdated
},
{
"package_uuid": "test-uuid-12446",
"name": "zulu17.48.15-ca-jdk17.0.10-win_aarhc4.zip",
Copy link
Copy Markdown
Author

@jameswald jameswald May 29, 2026

Choose a reason for hiding this comment

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

zulu17.48.15-ca-jdk17.0.10-win_aarch64.zip is the correct file name according to https://cdn.azul.com/zulu/bin.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed with 0731a04.

Comment thread README.md
**NOTE:** AdoptOpenJDK got moved to Eclipse Temurin and won't be updated anymore. It is highly recommended to migrate workflows from `adopt` and `adopt-openj9`, to `temurin` and `semeru` respectively, to keep receiving software and security updates. See more details in the [Good-bye AdoptOpenJDK post](https://blog.adoptopenjdk.net/2021/08/goodbye-adoptopenjdk-hello-adoptium/).

**NOTE:** For Azul Zulu OpenJDK architectures x64 and arm64 are mapped to x86 / arm with proper hw_bitness.
**NOTE:** For Azul Zulu OpenJDK, architecture `arm64` is mapped to `aarch64` when querying the Azul Metadata API.
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I'm definitely not an expert on this but I suspect the x64 mapping is an appropriate change and won't need to be called out in README.md.

@jameswald jameswald changed the title Use Azul metadata API Migrate from Zulu Discovery API to Azul Metadata API May 29, 2026
@jameswald jameswald force-pushed the azul-metadata-api branch from df4cd23 to 874ffb6 Compare May 29, 2026 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate to new Azul metadata API (from Zulu Discovery API)

2 participants