mirror of
https://github.com/actions/setup-java.git
synced 2026-08-19 04:02:51 +00: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:
co-authored by
Copilot App
parent
d0e61fe743
commit
4fbd0bd19d
@@ -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