mirror of
https://github.com/actions/setup-java.git
synced 2026-08-06 14:09:29 +08:00
fix: select musl JDK artifacts on Alpine for five distributions (#1220)
On Alpine, `getPlatformOption()` returned the glibc platform key for Dragonwell, Corretto, Zulu, Liberica and Liberica NIK, so the action resolved and installed a glibc JDK that cannot run under musl. Add a shared `isAlpineLinux()` helper and use it to select each vendor's musl artifacts: | distribution | glibc | musl | | ------------ | ------------- | -------------- | | Dragonwell | `linux` | `alpine-linux` | | Corretto | `linux` | `alpine` | | Zulu | `linux_glibc` | `linux_musl` | | Liberica | `linux` | `linux-musl` | | Liberica NIK | `linux` | `linux-musl` | Each key was verified against the vendor's live metadata API or manifest. There is deliberately no silent fallback to glibc when a vendor has no musl build for the requested version or architecture: the existing "could not find a version that satisfies" error fires instead. This matches the behaviour Temurin and SapMachine already have, and a glibc JDK would not run on musl anyway. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 74248bb0-72af-41d8-b85d-b0f5836e68db
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
||||
beforeAll,
|
||||
afterAll
|
||||
} from '@jest/globals';
|
||||
import fs from 'fs';
|
||||
import type {JavaInstallerOptions} from '../../src/distributions/base-models.js';
|
||||
import {HttpClient} from '@actions/http-client';
|
||||
|
||||
@@ -323,3 +324,50 @@ describe('getAvailableVersions', () => {
|
||||
spyGetDownloadArchiveExtension.mockReturnValue(mockedExtension);
|
||||
};
|
||||
});
|
||||
|
||||
describe('Corretto getPlatformOption libc selection', () => {
|
||||
const originalPlatform = Object.getOwnPropertyDescriptor(
|
||||
process,
|
||||
'platform'
|
||||
) as PropertyDescriptor;
|
||||
|
||||
const setPlatform = (platform: NodeJS.Platform) =>
|
||||
Object.defineProperty(process, 'platform', {
|
||||
...originalPlatform,
|
||||
value: platform
|
||||
});
|
||||
|
||||
const distribution = new CorrettoDistribution({
|
||||
version: '21',
|
||||
architecture: 'x64',
|
||||
packageType: 'jdk',
|
||||
checkLatest: false
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
Object.defineProperty(process, 'platform', originalPlatform);
|
||||
jest.restoreAllMocks();
|
||||
});
|
||||
|
||||
it('selects the musl artifacts on Alpine', () => {
|
||||
setPlatform('linux');
|
||||
jest.spyOn(fs, 'existsSync').mockReturnValue(true);
|
||||
|
||||
expect(distribution['getPlatformOption']()).toBe('alpine');
|
||||
});
|
||||
|
||||
it('selects the glibc artifacts on other Linux runners', () => {
|
||||
setPlatform('linux');
|
||||
jest.spyOn(fs, 'existsSync').mockReturnValue(false);
|
||||
|
||||
expect(distribution['getPlatformOption']()).toBe('linux');
|
||||
});
|
||||
|
||||
it('does not probe for Alpine off Linux', () => {
|
||||
setPlatform('darwin');
|
||||
const existsSync = jest.spyOn(fs, 'existsSync');
|
||||
|
||||
expect(distribution['getPlatformOption']()).toBe('macos');
|
||||
expect(existsSync).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
beforeAll,
|
||||
afterAll
|
||||
} from '@jest/globals';
|
||||
import fs from 'fs';
|
||||
import {HttpClient} from '@actions/http-client';
|
||||
|
||||
import manifestData from '../data/dragonwell.json' with {type: 'json'};
|
||||
@@ -307,3 +308,50 @@ describe('getAvailableVersions', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Dragonwell getPlatformOption libc selection', () => {
|
||||
const originalPlatform = Object.getOwnPropertyDescriptor(
|
||||
process,
|
||||
'platform'
|
||||
) as PropertyDescriptor;
|
||||
|
||||
const setPlatform = (platform: NodeJS.Platform) =>
|
||||
Object.defineProperty(process, 'platform', {
|
||||
...originalPlatform,
|
||||
value: platform
|
||||
});
|
||||
|
||||
const distribution = new DragonwellDistribution({
|
||||
version: '21',
|
||||
architecture: 'x64',
|
||||
packageType: 'jdk',
|
||||
checkLatest: false
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
Object.defineProperty(process, 'platform', originalPlatform);
|
||||
jest.restoreAllMocks();
|
||||
});
|
||||
|
||||
it('selects the musl artifacts on Alpine', () => {
|
||||
setPlatform('linux');
|
||||
jest.spyOn(fs, 'existsSync').mockReturnValue(true);
|
||||
|
||||
expect(distribution['getPlatformOption']()).toBe('alpine-linux');
|
||||
});
|
||||
|
||||
it('selects the glibc artifacts on other Linux runners', () => {
|
||||
setPlatform('linux');
|
||||
jest.spyOn(fs, 'existsSync').mockReturnValue(false);
|
||||
|
||||
expect(distribution['getPlatformOption']()).toBe('linux');
|
||||
});
|
||||
|
||||
it('does not probe for Alpine off Linux', () => {
|
||||
setPlatform('win32');
|
||||
const existsSync = jest.spyOn(fs, 'existsSync');
|
||||
|
||||
expect(distribution['getPlatformOption']()).toBe('windows');
|
||||
expect(existsSync).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
beforeAll,
|
||||
afterAll
|
||||
} from '@jest/globals';
|
||||
import fs from 'fs';
|
||||
import type {
|
||||
ArchitectureOptions,
|
||||
LibericaVersion
|
||||
@@ -260,6 +261,16 @@ describe('findPackageForDownload', () => {
|
||||
});
|
||||
|
||||
describe('getPlatformOption', () => {
|
||||
beforeEach(() => {
|
||||
// The linux row below is glibc, so pin the Alpine probe rather than
|
||||
// letting it depend on the machine running the suite.
|
||||
jest.spyOn(fs, 'existsSync').mockReturnValue(false);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
jest.restoreAllMocks();
|
||||
});
|
||||
|
||||
const distributions = new LibericaDistributions({
|
||||
architecture: 'x64',
|
||||
version: '11',
|
||||
@@ -335,3 +346,35 @@ describe('convertVersionToSemver', () => {
|
||||
expect(actual).toEqual(expected);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Liberica getPlatformOption libc selection', () => {
|
||||
const distributions = new LibericaDistributions({
|
||||
architecture: 'x64',
|
||||
version: '11',
|
||||
packageType: 'jdk',
|
||||
checkLatest: false
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
jest.restoreAllMocks();
|
||||
});
|
||||
|
||||
it('selects the musl artifacts on Alpine', () => {
|
||||
jest.spyOn(fs, 'existsSync').mockReturnValue(true);
|
||||
|
||||
expect(distributions['getPlatformOption']('linux')).toBe('linux-musl');
|
||||
});
|
||||
|
||||
it('selects the glibc artifacts on other Linux runners', () => {
|
||||
jest.spyOn(fs, 'existsSync').mockReturnValue(false);
|
||||
|
||||
expect(distributions['getPlatformOption']('linux')).toBe('linux');
|
||||
});
|
||||
|
||||
it('does not probe for Alpine off Linux', () => {
|
||||
const existsSync = jest.spyOn(fs, 'existsSync');
|
||||
|
||||
expect(distributions['getPlatformOption']('darwin')).toBe('macos');
|
||||
expect(existsSync).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import {jest, describe, it, expect, beforeEach, afterEach} from '@jest/globals';
|
||||
import fs from 'fs';
|
||||
import type {
|
||||
ArchitectureOptions,
|
||||
NikVersion
|
||||
@@ -170,6 +171,16 @@ describe('findPackageForDownload', () => {
|
||||
});
|
||||
|
||||
describe('getPlatformOption', () => {
|
||||
beforeEach(() => {
|
||||
// The linux row below is glibc, so pin the Alpine probe rather than
|
||||
// letting it depend on the machine running the suite.
|
||||
jest.spyOn(fs, 'existsSync').mockReturnValue(false);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
jest.restoreAllMocks();
|
||||
});
|
||||
|
||||
const distributions = new LibericaNikDistributions({
|
||||
architecture: 'x64',
|
||||
version: '21',
|
||||
@@ -217,3 +228,35 @@ describe('convertVersionToSemver', () => {
|
||||
expect(actual).toEqual(expected);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Liberica NIK getPlatformOption libc selection', () => {
|
||||
const distributions = new LibericaNikDistributions({
|
||||
architecture: 'x64',
|
||||
version: '21',
|
||||
packageType: 'jdk',
|
||||
checkLatest: false
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
jest.restoreAllMocks();
|
||||
});
|
||||
|
||||
it('selects the musl artifacts on Alpine', () => {
|
||||
jest.spyOn(fs, 'existsSync').mockReturnValue(true);
|
||||
|
||||
expect(distributions['getPlatformOption']('linux')).toBe('linux-musl');
|
||||
});
|
||||
|
||||
it('selects the glibc artifacts on other Linux runners', () => {
|
||||
jest.spyOn(fs, 'existsSync').mockReturnValue(false);
|
||||
|
||||
expect(distributions['getPlatformOption']('linux')).toBe('linux');
|
||||
});
|
||||
|
||||
it('does not probe for Alpine off Linux', () => {
|
||||
const existsSync = jest.spyOn(fs, 'existsSync');
|
||||
|
||||
expect(distributions['getPlatformOption']('darwin')).toBe('macos');
|
||||
expect(existsSync).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
beforeAll,
|
||||
afterAll
|
||||
} from '@jest/globals';
|
||||
import fs from 'fs';
|
||||
import type {IZuluVersions} from '../../src/distributions/zulu/models.js';
|
||||
import {HttpClient} from '@actions/http-client';
|
||||
import os from 'os';
|
||||
@@ -346,3 +347,50 @@ describe('findPackageForDownload', () => {
|
||||
).rejects.toThrow(/No matching version found for SemVer/);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Zulu getPlatformOption libc selection', () => {
|
||||
const originalPlatform = Object.getOwnPropertyDescriptor(
|
||||
process,
|
||||
'platform'
|
||||
) as PropertyDescriptor;
|
||||
|
||||
const setPlatform = (platform: NodeJS.Platform) =>
|
||||
Object.defineProperty(process, 'platform', {
|
||||
...originalPlatform,
|
||||
value: platform
|
||||
});
|
||||
|
||||
const distribution = new ZuluDistribution({
|
||||
version: '21',
|
||||
architecture: 'x64',
|
||||
packageType: 'jdk',
|
||||
checkLatest: false
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
Object.defineProperty(process, 'platform', originalPlatform);
|
||||
jest.restoreAllMocks();
|
||||
});
|
||||
|
||||
it('selects the musl artifacts on Alpine', () => {
|
||||
setPlatform('linux');
|
||||
jest.spyOn(fs, 'existsSync').mockReturnValue(true);
|
||||
|
||||
expect(distribution['getPlatformOption']()).toBe('linux_musl');
|
||||
});
|
||||
|
||||
it('selects the glibc artifacts on other Linux runners', () => {
|
||||
setPlatform('linux');
|
||||
jest.spyOn(fs, 'existsSync').mockReturnValue(false);
|
||||
|
||||
expect(distribution['getPlatformOption']()).toBe('linux_glibc');
|
||||
});
|
||||
|
||||
it('does not probe for Alpine off Linux', () => {
|
||||
setPlatform('win32');
|
||||
const existsSync = jest.spyOn(fs, 'existsSync');
|
||||
|
||||
expect(distribution['getPlatformOption']()).toBe('windows');
|
||||
expect(existsSync).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
Vendored
+4
@@ -15,6 +15,8 @@ export const modules = {
|
||||
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_2__);
|
||||
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4527);
|
||||
/* harmony import */ var _base_installer_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(6242);
|
||||
/* harmony import */ var _platform_types_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(7444);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -136,6 +138,8 @@ class CorrettoDistribution extends _base_installer_js__WEBPACK_IMPORTED_MODULE_4
|
||||
return 'macos';
|
||||
case 'win32':
|
||||
return 'windows';
|
||||
case 'linux':
|
||||
return (0,_platform_types_js__WEBPACK_IMPORTED_MODULE_5__/* .isAlpineLinux */ .G6)() ? 'alpine' : 'linux';
|
||||
default:
|
||||
return process.platform;
|
||||
}
|
||||
|
||||
Vendored
+9
-7
@@ -13,10 +13,12 @@ export const modules = {
|
||||
/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(semver__WEBPACK_IMPORTED_MODULE_1__);
|
||||
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4527);
|
||||
/* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(3838);
|
||||
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(9896);
|
||||
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_4__);
|
||||
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(6928);
|
||||
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_5__);
|
||||
/* harmony import */ var _platform_types_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7444);
|
||||
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(9896);
|
||||
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_5__);
|
||||
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(6928);
|
||||
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_6__);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -38,8 +40,8 @@ class LibericaNikDistributions extends _base_installer_js__WEBPACK_IMPORTED_MODU
|
||||
javaArchivePath = (0,_util_js__WEBPACK_IMPORTED_MODULE_2__/* .renameWinArchive */ .n2)(javaArchivePath);
|
||||
}
|
||||
const extractedJavaPath = await (0,_util_js__WEBPACK_IMPORTED_MODULE_2__/* .extractJdkFile */ .PE)(javaArchivePath, extension);
|
||||
const archiveName = fs__WEBPACK_IMPORTED_MODULE_4___default().readdirSync(extractedJavaPath)[0];
|
||||
const archivePath = path__WEBPACK_IMPORTED_MODULE_5___default().join(extractedJavaPath, archiveName);
|
||||
const archiveName = fs__WEBPACK_IMPORTED_MODULE_5___default().readdirSync(extractedJavaPath)[0];
|
||||
const archivePath = path__WEBPACK_IMPORTED_MODULE_6___default().join(extractedJavaPath, archiveName);
|
||||
const javaPath = await (0,_util_js__WEBPACK_IMPORTED_MODULE_2__/* .cacheJdkDir */ .Vj)(archivePath, this.toolcacheFolderName, this.getToolcacheVersionName(javaRelease.version), this.architecture);
|
||||
return { version: javaRelease.version, path: javaPath };
|
||||
}
|
||||
@@ -118,7 +120,7 @@ class LibericaNikDistributions extends _base_installer_js__WEBPACK_IMPORTED_MODU
|
||||
case 'cygwin':
|
||||
return 'windows';
|
||||
case 'linux':
|
||||
return 'linux';
|
||||
return (0,_platform_types_js__WEBPACK_IMPORTED_MODULE_4__/* .isAlpineLinux */ .G6)(platform) ? 'linux-musl' : 'linux';
|
||||
default:
|
||||
throw new Error(`Platform '${platform}' is not supported. Supported platforms: ${supportedPlatform}`);
|
||||
}
|
||||
|
||||
Vendored
+9
-7
@@ -13,10 +13,12 @@ export const modules = {
|
||||
/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(semver__WEBPACK_IMPORTED_MODULE_1__);
|
||||
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4527);
|
||||
/* harmony import */ var _actions_core__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(3838);
|
||||
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(9896);
|
||||
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_4__);
|
||||
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(6928);
|
||||
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_5__);
|
||||
/* harmony import */ var _platform_types_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7444);
|
||||
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(9896);
|
||||
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_5__);
|
||||
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(6928);
|
||||
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_6__);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -38,8 +40,8 @@ class LibericaDistributions extends _base_installer_js__WEBPACK_IMPORTED_MODULE_
|
||||
javaArchivePath = (0,_util_js__WEBPACK_IMPORTED_MODULE_2__/* .renameWinArchive */ .n2)(javaArchivePath);
|
||||
}
|
||||
const extractedJavaPath = await (0,_util_js__WEBPACK_IMPORTED_MODULE_2__/* .extractJdkFile */ .PE)(javaArchivePath, extension);
|
||||
const archiveName = fs__WEBPACK_IMPORTED_MODULE_4___default().readdirSync(extractedJavaPath)[0];
|
||||
const archivePath = path__WEBPACK_IMPORTED_MODULE_5___default().join(extractedJavaPath, archiveName);
|
||||
const archiveName = fs__WEBPACK_IMPORTED_MODULE_5___default().readdirSync(extractedJavaPath)[0];
|
||||
const archivePath = path__WEBPACK_IMPORTED_MODULE_6___default().join(extractedJavaPath, archiveName);
|
||||
const javaPath = await (0,_util_js__WEBPACK_IMPORTED_MODULE_2__/* .cacheJdkDir */ .Vj)(archivePath, this.toolcacheFolderName, this.getToolcacheVersionName(javaRelease.version), this.architecture);
|
||||
return { version: javaRelease.version, path: javaPath };
|
||||
}
|
||||
@@ -118,7 +120,7 @@ class LibericaDistributions extends _base_installer_js__WEBPACK_IMPORTED_MODULE_
|
||||
case 'cygwin':
|
||||
return 'windows';
|
||||
case 'linux':
|
||||
return 'linux';
|
||||
return (0,_platform_types_js__WEBPACK_IMPORTED_MODULE_4__/* .isAlpineLinux */ .G6)(platform) ? 'linux-musl' : 'linux';
|
||||
case 'sunos':
|
||||
return 'solaris';
|
||||
default:
|
||||
|
||||
Vendored
+4
@@ -17,6 +17,8 @@ export const modules = {
|
||||
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_3__);
|
||||
/* harmony import */ var _base_installer_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(6242);
|
||||
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(4527);
|
||||
/* harmony import */ var _platform_types_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(7444);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -145,6 +147,8 @@ class DragonwellDistribution extends _base_installer_js__WEBPACK_IMPORTED_MODULE
|
||||
switch (process.platform) {
|
||||
case 'win32':
|
||||
return 'windows';
|
||||
case 'linux':
|
||||
return (0,_platform_types_js__WEBPACK_IMPORTED_MODULE_6__/* .isAlpineLinux */ .G6)() ? 'alpine-linux' : 'linux';
|
||||
default:
|
||||
return process.platform;
|
||||
}
|
||||
|
||||
Vendored
+15
-12
@@ -16,7 +16,9 @@ export const modules = {
|
||||
/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(2088);
|
||||
/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(semver__WEBPACK_IMPORTED_MODULE_3__);
|
||||
/* harmony import */ var _base_installer_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(6242);
|
||||
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(4527);
|
||||
/* harmony import */ var _platform_types_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(7444);
|
||||
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(4527);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -37,14 +39,14 @@ class ZuluDistribution extends _base_installer_js__WEBPACK_IMPORTED_MODULE_4__/*
|
||||
? [...item.java_version, item.openjdk_build_number]
|
||||
: item.java_version;
|
||||
return {
|
||||
version: (0,_util_js__WEBPACK_IMPORTED_MODULE_5__/* .convertVersionToSemver */ .ZY)(javaVersion),
|
||||
version: (0,_util_js__WEBPACK_IMPORTED_MODULE_6__/* .convertVersionToSemver */ .ZY)(javaVersion),
|
||||
url: item.download_url,
|
||||
zuluVersion: (0,_util_js__WEBPACK_IMPORTED_MODULE_5__/* .convertVersionToSemver */ .ZY)(item.distro_version),
|
||||
zuluVersion: (0,_util_js__WEBPACK_IMPORTED_MODULE_6__/* .convertVersionToSemver */ .ZY)(item.distro_version),
|
||||
packageUuid: item.package_uuid
|
||||
};
|
||||
});
|
||||
const satisfiedVersions = availableVersions
|
||||
.filter(item => (0,_util_js__WEBPACK_IMPORTED_MODULE_5__/* .isVersionSatisfies */ .y)(version, item.version))
|
||||
.filter(item => (0,_util_js__WEBPACK_IMPORTED_MODULE_6__/* .isVersionSatisfies */ .y)(version, item.version))
|
||||
.sort((a, b) => {
|
||||
// Azul provides two versions: java_version and distro_version
|
||||
// we should sort by both fields by descending
|
||||
@@ -83,21 +85,21 @@ class ZuluDistribution extends _base_installer_js__WEBPACK_IMPORTED_MODULE_4__/*
|
||||
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .info */ .pq(`Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`);
|
||||
let javaArchivePath = await this.downloadAndVerify(javaRelease);
|
||||
_actions_core__WEBPACK_IMPORTED_MODULE_0__/* .info */ .pq(`Extracting Java archive...`);
|
||||
const extension = (0,_util_js__WEBPACK_IMPORTED_MODULE_5__/* .getDownloadArchiveExtension */ .ag)();
|
||||
const extension = (0,_util_js__WEBPACK_IMPORTED_MODULE_6__/* .getDownloadArchiveExtension */ .ag)();
|
||||
if (process.platform === 'win32') {
|
||||
javaArchivePath = (0,_util_js__WEBPACK_IMPORTED_MODULE_5__/* .renameWinArchive */ .n2)(javaArchivePath);
|
||||
javaArchivePath = (0,_util_js__WEBPACK_IMPORTED_MODULE_6__/* .renameWinArchive */ .n2)(javaArchivePath);
|
||||
}
|
||||
const extractedJavaPath = await (0,_util_js__WEBPACK_IMPORTED_MODULE_5__/* .extractJdkFile */ .PE)(javaArchivePath, extension);
|
||||
const extractedJavaPath = await (0,_util_js__WEBPACK_IMPORTED_MODULE_6__/* .extractJdkFile */ .PE)(javaArchivePath, extension);
|
||||
const archiveName = fs__WEBPACK_IMPORTED_MODULE_2___default().readdirSync(extractedJavaPath)[0];
|
||||
const archivePath = path__WEBPACK_IMPORTED_MODULE_1___default().join(extractedJavaPath, archiveName);
|
||||
const javaPath = await (0,_util_js__WEBPACK_IMPORTED_MODULE_5__/* .cacheJdkDir */ .Vj)(archivePath, this.toolcacheFolderName, this.getToolcacheVersionName(javaRelease.version), this.architecture);
|
||||
const javaPath = await (0,_util_js__WEBPACK_IMPORTED_MODULE_6__/* .cacheJdkDir */ .Vj)(archivePath, this.toolcacheFolderName, this.getToolcacheVersionName(javaRelease.version), this.architecture);
|
||||
return { version: javaRelease.version, path: javaPath };
|
||||
}
|
||||
async getAvailableVersions() {
|
||||
const arch = this.getArchitectureOptions();
|
||||
const [bundleType, features] = this.packageType.split('+');
|
||||
const platform = this.getPlatformOption();
|
||||
const extension = (0,_util_js__WEBPACK_IMPORTED_MODULE_5__/* .getDownloadArchiveExtension */ .ag)();
|
||||
const extension = (0,_util_js__WEBPACK_IMPORTED_MODULE_6__/* .getDownloadArchiveExtension */ .ag)();
|
||||
const javafx = features?.includes('fx') ?? false;
|
||||
const crac = features?.includes('crac') ?? false;
|
||||
const releaseStatus = this.stable ? 'ga' : 'ea';
|
||||
@@ -180,9 +182,10 @@ class ZuluDistribution extends _base_installer_js__WEBPACK_IMPORTED_MODULE_4__/*
|
||||
case 'win32':
|
||||
return 'windows';
|
||||
case 'linux':
|
||||
// The new Metadata API's "linux" value returns both glibc and musl packages;
|
||||
// use "linux_glibc" to target only glibc, which is what standard runners use.
|
||||
return 'linux_glibc';
|
||||
// The new Metadata API's "linux" value returns both glibc and musl
|
||||
// packages, so target the libc the runner actually has. A glibc JDK
|
||||
// cannot run on Alpine.
|
||||
return (0,_platform_types_js__WEBPACK_IMPORTED_MODULE_5__/* .isAlpineLinux */ .G6)() ? 'linux_musl' : 'linux_glibc';
|
||||
default:
|
||||
return process.platform;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import {
|
||||
ICorrettoAllAvailableVersions,
|
||||
ICorrettoAvailableVersions
|
||||
} from './models.js';
|
||||
import {isAlpineLinux} from '../platform-types.js';
|
||||
|
||||
const CORRETTO_VERSIONS_URL =
|
||||
'https://corretto.github.io/corretto-downloads/latest_links/indexmap_with_checksum.json';
|
||||
@@ -189,6 +190,8 @@ export class CorrettoDistribution extends JavaBase {
|
||||
return 'macos';
|
||||
case 'win32':
|
||||
return 'windows';
|
||||
case 'linux':
|
||||
return isAlpineLinux() ? 'alpine' : 'linux';
|
||||
default:
|
||||
return process.platform;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import {
|
||||
renameWinArchive
|
||||
} from '../../util.js';
|
||||
import {IDragonwellVersions, IDragonwellAllVersions} from './models.js';
|
||||
import {isAlpineLinux} from '../platform-types.js';
|
||||
import {
|
||||
JavaDownloadRelease,
|
||||
JavaInstallerOptions,
|
||||
@@ -202,6 +203,8 @@ export class DragonwellDistribution extends JavaBase {
|
||||
switch (process.platform) {
|
||||
case 'win32':
|
||||
return 'windows';
|
||||
case 'linux':
|
||||
return isAlpineLinux() ? 'alpine-linux' : 'linux';
|
||||
default:
|
||||
return process.platform;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import {
|
||||
} from '../../util.js';
|
||||
import * as core from '@actions/core';
|
||||
import {ArchitectureOptions, NikVersion, OsVersions} from './models.js';
|
||||
import {isAlpineLinux} from '../platform-types.js';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
@@ -156,7 +157,7 @@ export class LibericaNikDistributions extends JavaBase {
|
||||
case 'cygwin':
|
||||
return 'windows';
|
||||
case 'linux':
|
||||
return 'linux';
|
||||
return isAlpineLinux(platform) ? 'linux-musl' : 'linux';
|
||||
default:
|
||||
throw new Error(
|
||||
`Platform '${platform}' is not supported. Supported platforms: ${supportedPlatform}`
|
||||
|
||||
@@ -14,6 +14,7 @@ import {
|
||||
} from '../../util.js';
|
||||
import * as core from '@actions/core';
|
||||
import {ArchitectureOptions, LibericaVersion, OsVersions} from './models.js';
|
||||
import {isAlpineLinux} from '../platform-types.js';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
@@ -154,7 +155,7 @@ export class LibericaDistributions extends JavaBase {
|
||||
case 'cygwin':
|
||||
return 'windows';
|
||||
case 'linux':
|
||||
return 'linux';
|
||||
return isAlpineLinux(platform) ? 'linux-musl' : 'linux';
|
||||
case 'sunos':
|
||||
return 'solaris';
|
||||
default:
|
||||
|
||||
@@ -6,6 +6,7 @@ import semver from 'semver';
|
||||
|
||||
import {JavaBase} from '../base-installer.js';
|
||||
import {IZuluPackageDetails, IZuluVersions} from './models.js';
|
||||
import {isAlpineLinux} from '../platform-types.js';
|
||||
import {
|
||||
cacheJdkDir,
|
||||
extractJdkFile,
|
||||
@@ -239,9 +240,10 @@ export class ZuluDistribution extends JavaBase {
|
||||
case 'win32':
|
||||
return 'windows';
|
||||
case 'linux':
|
||||
// The new Metadata API's "linux" value returns both glibc and musl packages;
|
||||
// use "linux_glibc" to target only glibc, which is what standard runners use.
|
||||
return 'linux_glibc';
|
||||
// The new Metadata API's "linux" value returns both glibc and musl
|
||||
// packages, so target the libc the runner actually has. A glibc JDK
|
||||
// cannot run on Alpine.
|
||||
return isAlpineLinux() ? 'linux_musl' : 'linux_glibc';
|
||||
default:
|
||||
return process.platform;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user