diff --git a/__tests__/distributors/zulu-linux-installer.test.ts b/__tests__/distributors/zulu-linux-installer.test.ts index 0e956f20..23362704 100644 --- a/__tests__/distributors/zulu-linux-installer.test.ts +++ b/__tests__/distributors/zulu-linux-installer.test.ts @@ -58,7 +58,7 @@ describe('getAvailableVersions', () => { packageType: 'jdk', checkLatest: false }, - '?os=linux-glibc&arch=x86&archive_type=zip&java_package_type=jdk&javafx_bundled=false&crac_supported=false&release_status=ga&availability_types=ca&certifications=tck&page=1&page_size=100' + '?os=linux-glibc&arch=x64&archive_type=zip&java_package_type=jdk&javafx_bundled=false&crac_supported=false&release_status=ga&availability_types=ca&certifications=tck&page=1&page_size=100' ], [ { @@ -67,7 +67,7 @@ describe('getAvailableVersions', () => { packageType: 'jre', checkLatest: false }, - '?os=linux-glibc&arch=x86&archive_type=zip&java_package_type=jre&javafx_bundled=false&crac_supported=false&release_status=ga&availability_types=ca&certifications=tck&page=1&page_size=100' + '?os=linux-glibc&arch=x64&archive_type=zip&java_package_type=jre&javafx_bundled=false&crac_supported=false&release_status=ga&availability_types=ca&certifications=tck&page=1&page_size=100' ], [ { @@ -76,7 +76,7 @@ describe('getAvailableVersions', () => { packageType: 'jdk+fx', checkLatest: false }, - '?os=linux-glibc&arch=x86&archive_type=zip&java_package_type=jdk&javafx_bundled=true&crac_supported=false&release_status=ga&availability_types=ca&certifications=tck&page=1&page_size=100' + '?os=linux-glibc&arch=x64&archive_type=zip&java_package_type=jdk&javafx_bundled=true&crac_supported=false&release_status=ga&availability_types=ca&certifications=tck&page=1&page_size=100' ], [ { @@ -85,7 +85,7 @@ describe('getAvailableVersions', () => { packageType: 'jre+fx', checkLatest: false }, - '?os=linux-glibc&arch=x86&archive_type=zip&java_package_type=jre&javafx_bundled=true&crac_supported=false&release_status=ga&availability_types=ca&certifications=tck&page=1&page_size=100' + '?os=linux-glibc&arch=x64&archive_type=zip&java_package_type=jre&javafx_bundled=true&crac_supported=false&release_status=ga&availability_types=ca&certifications=tck&page=1&page_size=100' ], [ { @@ -94,7 +94,7 @@ describe('getAvailableVersions', () => { packageType: 'jdk', checkLatest: false }, - '?os=linux-glibc&arch=arm&archive_type=zip&java_package_type=jdk&javafx_bundled=false&crac_supported=false&release_status=ga&availability_types=ca&certifications=tck&page=1&page_size=100' + '?os=linux-glibc&arch=arm64&archive_type=zip&java_package_type=jdk&javafx_bundled=false&crac_supported=false&release_status=ga&availability_types=ca&certifications=tck&page=1&page_size=100' ], [ { @@ -139,7 +139,8 @@ describe('getAvailableVersions', () => { distribution['getPlatformOption'] = () => 'linux'; // Override extension for linux default arch case to match util behavior spyUtilGetDownloadArchiveExtension.mockReturnValue('tar.gz'); - const buildUrl = `https://api.azul.com/metadata/v1/zulu/packages/?os=linux-glibc&arch=${distroArch.arch}&archive_type=tar.gz&java_package_type=jdk&javafx_bundled=false&crac_supported=false&release_status=ga&availability_types=ca&certifications=tck&page=1&page_size=100`; + const expectedArch = distroArch.bitness === '64' && distroArch.arch === 'x86' ? 'x64' : distroArch.bitness === '64' && distroArch.arch === 'arm' ? 'arm64' : distroArch.arch; + const buildUrl = `https://api.azul.com/metadata/v1/zulu/packages/?os=linux-glibc&arch=${expectedArch}&archive_type=tar.gz&java_package_type=jdk&javafx_bundled=false&crac_supported=false&release_status=ga&availability_types=ca&certifications=tck&page=1&page_size=100`; await distribution['getAvailableVersions'](); diff --git a/__tests__/distributors/zulu-windows-installer.test.ts b/__tests__/distributors/zulu-windows-installer.test.ts index 6a3c66d5..2d51d963 100644 --- a/__tests__/distributors/zulu-windows-installer.test.ts +++ b/__tests__/distributors/zulu-windows-installer.test.ts @@ -58,7 +58,7 @@ describe('getAvailableVersions', () => { packageType: 'jdk', checkLatest: false }, - '?os=windows&arch=x86&archive_type=zip&java_package_type=jdk&javafx_bundled=false&crac_supported=false&release_status=ga&availability_types=ca&certifications=tck&page=1&page_size=100' + '?os=windows&arch=x64&archive_type=zip&java_package_type=jdk&javafx_bundled=false&crac_supported=false&release_status=ga&availability_types=ca&certifications=tck&page=1&page_size=100' ], [ { @@ -67,7 +67,7 @@ describe('getAvailableVersions', () => { packageType: 'jre', checkLatest: false }, - '?os=windows&arch=x86&archive_type=zip&java_package_type=jre&javafx_bundled=false&crac_supported=false&release_status=ga&availability_types=ca&certifications=tck&page=1&page_size=100' + '?os=windows&arch=x64&archive_type=zip&java_package_type=jre&javafx_bundled=false&crac_supported=false&release_status=ga&availability_types=ca&certifications=tck&page=1&page_size=100' ], [ { @@ -76,7 +76,7 @@ describe('getAvailableVersions', () => { packageType: 'jdk+fx', checkLatest: false }, - '?os=windows&arch=x86&archive_type=zip&java_package_type=jdk&javafx_bundled=true&crac_supported=false&release_status=ga&availability_types=ca&certifications=tck&page=1&page_size=100' + '?os=windows&arch=x64&archive_type=zip&java_package_type=jdk&javafx_bundled=true&crac_supported=false&release_status=ga&availability_types=ca&certifications=tck&page=1&page_size=100' ], [ { @@ -85,7 +85,7 @@ describe('getAvailableVersions', () => { packageType: 'jre+fx', checkLatest: false }, - '?os=windows&arch=x86&archive_type=zip&java_package_type=jre&javafx_bundled=true&crac_supported=false&release_status=ga&availability_types=ca&certifications=tck&page=1&page_size=100' + '?os=windows&arch=x64&archive_type=zip&java_package_type=jre&javafx_bundled=true&crac_supported=false&release_status=ga&availability_types=ca&certifications=tck&page=1&page_size=100' ], [ { @@ -94,7 +94,7 @@ describe('getAvailableVersions', () => { packageType: 'jdk', checkLatest: false }, - '?os=windows&arch=arm&archive_type=zip&java_package_type=jdk&javafx_bundled=false&crac_supported=false&release_status=ga&availability_types=ca&certifications=tck&page=1&page_size=100' + '?os=windows&arch=arm64&archive_type=zip&java_package_type=jdk&javafx_bundled=false&crac_supported=false&release_status=ga&availability_types=ca&certifications=tck&page=1&page_size=100' ], [ { @@ -137,7 +137,8 @@ describe('getAvailableVersions', () => { checkLatest: false }); distribution['getPlatformOption'] = () => 'windows'; - const buildUrl = `https://api.azul.com/metadata/v1/zulu/packages/?os=windows&arch=${distroArch.arch}&archive_type=zip&java_package_type=jdk&javafx_bundled=false&crac_supported=false&release_status=ga&availability_types=ca&certifications=tck&page=1&page_size=100`; + const expectedArch = distroArch.bitness === '64' && distroArch.arch === 'x86' ? 'x64' : distroArch.bitness === '64' && distroArch.arch === 'arm' ? 'arm64' : distroArch.arch; + const buildUrl = `https://api.azul.com/metadata/v1/zulu/packages/?os=windows&arch=${expectedArch}&archive_type=zip&java_package_type=jdk&javafx_bundled=false&crac_supported=false&release_status=ga&availability_types=ca&certifications=tck&page=1&page_size=100`; await distribution['getAvailableVersions'](); diff --git a/dist/setup/index.js b/dist/setup/index.js index 92b98856..b088fd1e 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -114789,33 +114789,45 @@ class ZuluDistribution extends base_installer_1.JavaBase { // Map old API parameters to new metadata API parameters const osParam = this.getOsParam(platform); const archiveType = this.getArchiveType(extension); - const requestArguments = [ - `os=${osParam}`, - `arch=${arch}`, - `archive_type=${archiveType}`, - `java_package_type=${bundleType}`, - `javafx_bundled=${javafx}`, - `crac_supported=${crac}`, - `release_status=${releaseStatus}`, - `availability_types=ca`, - `certifications=tck`, - `page=1`, - `page_size=100` - ] - .filter(Boolean) - .join('&'); - const availableVersionsUrl = `https://api.azul.com/metadata/v1/zulu/packages/?${requestArguments}`; - core.debug(`Gathering available versions from '${availableVersionsUrl}'`); - const availableVersions = (_c = (yield this.http.getJson(availableVersionsUrl)) - .result) !== null && _c !== void 0 ? _c : []; + const archParam = this.getArchParam(arch, hw_bitness); + // Fetch all pages to avoid missing packages when there are > 100 results + let allVersions = []; + 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`, + `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 = (_c = (yield this.http.getJson(availableVersionsUrl)) + .result) !== null && _c !== void 0 ? _c : []; + allVersions = allVersions.concat(pageResults); + // If we got fewer results than page size, we've reached the end + hasMore = pageResults.length === pageSize; + page++; + } if (core.isDebug()) { core.startGroup('Print information about available versions'); console.timeEnd('Retrieving available versions for Zulu took'); // eslint-disable-line no-console - core.debug(`Available versions: [${availableVersions.length}]`); - core.debug(availableVersions.map(item => item.java_version.join('.')).join(', ')); + core.debug(`Available versions: [${allVersions.length}]`); + core.debug(allVersions.map(item => item.java_version.join('.')).join(', ')); core.endGroup(); } - return availableVersions; + return allVersions; }); } getArchitectureOptions() { @@ -114857,6 +114869,24 @@ class ZuluDistribution extends base_installer_1.JavaBase { return platform; } } + getArchParam(arch, hw_bitness) { + // Map architecture to new metadata API arch parameter + // The new API uses x64, x86, arm64, arm (not the legacy x86 + hw_bitness pattern) + if (arch === 'x86' && hw_bitness === '64') { + return 'x64'; + } + else if (arch === 'x86' && hw_bitness === '32') { + return 'x86'; + } + else if (arch === 'arm' && hw_bitness === '64') { + return 'arm64'; + } + else if (arch === 'arm' && hw_bitness === '') { + return 'arm'; + } + // Fallback for other architectures + return arch; + } getArchiveType(extension) { // Map extension to archive_type parameter for new API switch (extension) { diff --git a/src/distributions/zulu/installer.ts b/src/distributions/zulu/installer.ts index 22781079..67384549 100644 --- a/src/distributions/zulu/installer.ts +++ b/src/distributions/zulu/installer.ts @@ -115,42 +115,57 @@ export class ZuluDistribution extends JavaBase { // 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); - const requestArguments = [ - `os=${osParam}`, - `arch=${arch}`, - `archive_type=${archiveType}`, - `java_package_type=${bundleType}`, - `javafx_bundled=${javafx}`, - `crac_supported=${crac}`, - `release_status=${releaseStatus}`, - `availability_types=ca`, - `certifications=tck`, - `page=1`, - `page_size=100` - ] - .filter(Boolean) - .join('&'); + // Fetch all pages to avoid missing packages when there are > 100 results + let allVersions: IZuluVersions[] = []; + let page = 1; + const pageSize = 100; + let hasMore = true; - const availableVersionsUrl = `https://api.azul.com/metadata/v1/zulu/packages/?${requestArguments}`; + 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`, + `certifications=tck`, + `page=${page}`, + `page_size=${pageSize}` + ] + .filter(Boolean) + .join('&'); - core.debug(`Gathering available versions from '${availableVersionsUrl}'`); + const availableVersionsUrl = `https://api.azul.com/metadata/v1/zulu/packages/?${requestArguments}`; - const availableVersions = - (await this.http.getJson>(availableVersionsUrl)) - .result ?? []; + core.debug(`Gathering available versions from '${availableVersionsUrl}'`); + + const pageResults = + (await this.http.getJson>(availableVersionsUrl)) + .result ?? []; + + allVersions = allVersions.concat(pageResults); + + // If we got fewer results than page size, we've reached the end + hasMore = pageResults.length === pageSize; + page++; + } if (core.isDebug()) { core.startGroup('Print information about available versions'); console.timeEnd('Retrieving available versions for Zulu took'); // eslint-disable-line no-console - core.debug(`Available versions: [${availableVersions.length}]`); + core.debug(`Available versions: [${allVersions.length}]`); core.debug( - availableVersions.map(item => item.java_version.join('.')).join(', ') + allVersions.map(item => item.java_version.join('.')).join(', ') ); core.endGroup(); } - return availableVersions; + return allVersions; } private getArchitectureOptions(): { @@ -199,6 +214,22 @@ export class ZuluDistribution extends JavaBase { } } + private getArchParam(arch: string, hw_bitness: string): string { + // Map architecture to new metadata API arch parameter + // The new API uses x64, x86, arm64, arm (not the legacy x86 + hw_bitness pattern) + if (arch === 'x86' && hw_bitness === '64') { + return 'x64'; + } else if (arch === 'x86' && hw_bitness === '32') { + return 'x86'; + } else if (arch === 'arm' && hw_bitness === '64') { + return 'arm64'; + } else if (arch === 'arm' && hw_bitness === '') { + return 'arm'; + } + // Fallback for other architectures + return arch; + } + private getArchiveType(extension: string): string { // Map extension to archive_type parameter for new API switch (extension) {