Skip to content

Commit 8a3e815

Browse files
brunoborgesCopilot
andauthored
Map Zulu x86 architecture to i686 for Azul Metadata API (#1079)
The Azul Metadata API's `arch=x86` returns both 32-bit (i686) and 64-bit (x64) packages. Because the two variants share identical java_version and distro_version, setup-java cannot distinguish them and may resolve an explicit `architecture: x86` request to a 64-bit JDK (and for Java 21+, where 32-bit is dropped, x86 silently returns x64 instead of failing). The legacy Zulu Discovery API used `arch=x86&hw_bitness=32` to target only 32-bit builds. The Metadata API exposes the equivalent via `arch=i686`, which returns only genuine 32-bit builds with full version parity to the old behavior. Map x86 -> i686 to restore correct 32-bit resolution. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent f712137 commit 8a3e815

5 files changed

Lines changed: 19 additions & 11 deletions

File tree

‎__tests__/distributors/zulu-installer.test.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ describe('getAvailableVersions', () => {
8787
packageType: 'jdk',
8888
checkLatest: false
8989
},
90-
'?os=macos&archive_type=tar.gz&java_package_type=jdk&javafx_bundled=false&crac_supported=false&arch=x86&release_status=ga&availability_types=ca&page=1&page_size=100'
90+
'?os=macos&archive_type=tar.gz&java_package_type=jdk&javafx_bundled=false&crac_supported=false&arch=i686&release_status=ga&availability_types=ca&page=1&page_size=100'
9191
],
9292
[
9393
{
@@ -96,7 +96,7 @@ describe('getAvailableVersions', () => {
9696
packageType: 'jdk',
9797
checkLatest: false
9898
},
99-
'?os=macos&archive_type=tar.gz&java_package_type=jdk&javafx_bundled=false&crac_supported=false&arch=x86&release_status=ea&availability_types=ca&page=1&page_size=100'
99+
'?os=macos&archive_type=tar.gz&java_package_type=jdk&javafx_bundled=false&crac_supported=false&arch=i686&release_status=ea&availability_types=ca&page=1&page_size=100'
100100
],
101101
[
102102
{
@@ -225,7 +225,7 @@ describe('getAvailableVersions', () => {
225225
describe('getArchitectureOptions', () => {
226226
it.each([
227227
[{architecture: 'x64'}, 'x64'],
228-
[{architecture: 'x86'}, 'x86'],
228+
[{architecture: 'x86'}, 'i686'],
229229
[{architecture: 'aarch64'}, 'aarch64'],
230230
[{architecture: 'arm64'}, 'aarch64'],
231231
[{architecture: 'arm'}, 'arm']

‎__tests__/distributors/zulu-linux-installer.test.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ describe('getAvailableVersions', () => {
8989
packageType: 'jdk',
9090
checkLatest: false
9191
},
92-
'?os=linux_glibc&archive_type=zip&java_package_type=jdk&javafx_bundled=false&crac_supported=false&arch=x86&release_status=ga&availability_types=ca&page=1&page_size=100'
92+
'?os=linux_glibc&archive_type=zip&java_package_type=jdk&javafx_bundled=false&crac_supported=false&arch=i686&release_status=ga&availability_types=ca&page=1&page_size=100'
9393
],
9494
[
9595
{
@@ -98,7 +98,7 @@ describe('getAvailableVersions', () => {
9898
packageType: 'jdk',
9999
checkLatest: false
100100
},
101-
'?os=linux_glibc&archive_type=zip&java_package_type=jdk&javafx_bundled=false&crac_supported=false&arch=x86&release_status=ea&availability_types=ca&page=1&page_size=100'
101+
'?os=linux_glibc&archive_type=zip&java_package_type=jdk&javafx_bundled=false&crac_supported=false&arch=i686&release_status=ea&availability_types=ca&page=1&page_size=100'
102102
],
103103
[
104104
{
@@ -229,7 +229,7 @@ describe('getAvailableVersions', () => {
229229
describe('getArchitectureOptions', () => {
230230
it.each([
231231
[{architecture: 'x64'}, 'x64'],
232-
[{architecture: 'x86'}, 'x86'],
232+
[{architecture: 'x86'}, 'i686'],
233233
[{architecture: 'aarch64'}, 'aarch64'],
234234
[{architecture: 'arm64'}, 'aarch64'],
235235
[{architecture: 'arm'}, 'arm']

‎__tests__/distributors/zulu-windows-installer.test.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ describe('getAvailableVersions', () => {
8888
packageType: 'jdk',
8989
checkLatest: false
9090
},
91-
'?os=windows&archive_type=zip&java_package_type=jdk&javafx_bundled=false&crac_supported=false&arch=x86&release_status=ga&availability_types=ca&page=1&page_size=100'
91+
'?os=windows&archive_type=zip&java_package_type=jdk&javafx_bundled=false&crac_supported=false&arch=i686&release_status=ga&availability_types=ca&page=1&page_size=100'
9292
],
9393
[
9494
{
@@ -97,7 +97,7 @@ describe('getAvailableVersions', () => {
9797
packageType: 'jdk',
9898
checkLatest: false
9999
},
100-
'?os=windows&archive_type=zip&java_package_type=jdk&javafx_bundled=false&crac_supported=false&arch=x86&release_status=ea&availability_types=ca&page=1&page_size=100'
100+
'?os=windows&archive_type=zip&java_package_type=jdk&javafx_bundled=false&crac_supported=false&arch=i686&release_status=ea&availability_types=ca&page=1&page_size=100'
101101
],
102102
[
103103
{
@@ -226,7 +226,7 @@ describe('getAvailableVersions', () => {
226226
describe('getArchitectureOptions', () => {
227227
it.each([
228228
[{architecture: 'x64'}, 'x64'],
229-
[{architecture: 'x86'}, 'x86'],
229+
[{architecture: 'x86'}, 'i686'],
230230
[{architecture: 'aarch64'}, 'aarch64'],
231231
[{architecture: 'arm64'}, 'aarch64'],
232232
[{architecture: 'arm'}, 'arm']

‎dist/setup/index.js‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131465,7 +131465,11 @@ class ZuluDistribution extends JavaBase {
131465131465
case 'x64':
131466131466
return 'x64';
131467131467
case 'x86':
131468-
return 'x86';
131468+
// The Azul Metadata API's "x86" value returns both 32-bit (i686) and
131469+
// 64-bit (x64) packages, which are indistinguishable by version and
131470+
// would let a 32-bit request resolve to a 64-bit JDK. Use "i686" to
131471+
// target only genuine 32-bit builds, matching the legacy API behavior.
131472+
return 'i686';
131469131473
case 'aarch64':
131470131474
case 'arm64':
131471131475
return 'aarch64';

‎src/distributions/zulu/installer.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,11 @@ export class ZuluDistribution extends JavaBase {
185185
case 'x64':
186186
return 'x64';
187187
case 'x86':
188-
return 'x86';
188+
// The Azul Metadata API's "x86" value returns both 32-bit (i686) and
189+
// 64-bit (x64) packages, which are indistinguishable by version and
190+
// would let a 32-bit request resolve to a 64-bit JDK. Use "i686" to
191+
// target only genuine 32-bit builds, matching the legacy API behavior.
192+
return 'i686';
189193
case 'aarch64':
190194
case 'arm64':
191195
return 'aarch64';

0 commit comments

Comments
 (0)