mirror of
https://gitea.com/actions/setup-java.git
synced 2026-08-07 02:31:20 +00:00
Fix JDK resolution cache platform identity (#1210)
* Fix JDK resolution cache platform identity Include the effective Linux libc platform in JDK resolution cache keys so Alpine/musl and glibc runners cannot restore each other's release metadata. Bump the cache namespace and share Alpine detection with affected distributors.\n\nCo-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>\nCopilot-Session: 4f95577c-567c-47a8-92f2-b4dced527866 * Update generated action bundles Regenerate setup and cleanup distributions for the platform-aware JDK resolution cache.\n\nCo-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>\nCopilot-Session: 4f95577c-567c-47a8-92f2-b4dced527866 * Cover the platform-identity fallback and Alpine short-circuit getJavaPlatformIdentity's `?? platform` fallback and the alias path for platforms other than linux/darwin/win32 had no coverage, and isAlpineLinux had no direct test at all. Verified by mutation: replacing the fallback with a constant, and dropping the `platform === 'linux'` short-circuit from isAlpineLinux, both left the existing suite fully green. The added cases fail on each. The short-circuit case matters beyond coverage bookkeeping: it is what keeps the /etc/alpine-release probe from running on non-Linux runners, so a stray file can never make Windows or macOS resolve as musl. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 74248bb0-72af-41d8-b85d-b0f5836e68db * Carry the platform identity into the floating resolution request Merging main brought in #1219, which added getFloatingResolutionRequest as a second construction site for JdkResolutionRequest. It predates the required `platform` field, so the merged tree did not compile. The floating request already carries `source`, which pins the artifact bytes, so this changes no lookup behaviour on its own -- it keeps the two request builders consistent and the tree building. Also refreshes dist/, which the textual merge left stale. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 74248bb0-72af-41d8-b85d-b0f5836e68db --------- Co-authored-by: Bruno Borges <brborges@microsoft.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 74248bb0-72af-41d8-b85d-b0f5836e68db
This commit is contained in:
Vendored
+39
-22
@@ -30988,33 +30988,38 @@ function createUnsupportedPackageError(distributionName, packageType, supportedP
|
||||
/***/ ((__unused_webpack_module, __webpack_exports__, __nccwpck_require__) => {
|
||||
|
||||
/* harmony export */ __nccwpck_require__.d(__webpack_exports__, {
|
||||
/* harmony export */ G6: () => (/* binding */ isAlpineLinux),
|
||||
/* harmony export */ U: () => (/* binding */ getJavaPlatformIdentity),
|
||||
/* harmony export */ dV: () => (/* binding */ normalizeArchitecture),
|
||||
/* harmony export */ sZ: () => (/* binding */ validateJavaPlatform)
|
||||
/* harmony export */ });
|
||||
/* unused harmony exports JAVA_PLATFORM_CAPABILITIES, normalizePlatform */
|
||||
/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require__(2088);
|
||||
/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nccwpck_require__.n(semver__WEBPACK_IMPORTED_MODULE_0__);
|
||||
/* harmony import */ var _package_types_js__WEBPACK_IMPORTED_MODULE_1__ = __nccwpck_require__(7835);
|
||||
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require__(9896);
|
||||
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nccwpck_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
|
||||
/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_1__ = __nccwpck_require__(2088);
|
||||
/* harmony import */ var semver__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__nccwpck_require__.n(semver__WEBPACK_IMPORTED_MODULE_1__);
|
||||
/* harmony import */ var _package_types_js__WEBPACK_IMPORTED_MODULE_2__ = __nccwpck_require__(7835);
|
||||
|
||||
|
||||
|
||||
const X64_ARM64 = ['x64', 'aarch64'];
|
||||
const STANDARD_LINUX = ['x64', 'x86', 'aarch64', 'ppc64le', 's390x'];
|
||||
const JAVA_PLATFORM_CAPABILITIES = {
|
||||
[_package_types_js__WEBPACK_IMPORTED_MODULE_1__/* .JavaDistribution */ .zS.Temurin]: {
|
||||
[_package_types_js__WEBPACK_IMPORTED_MODULE_2__/* .JavaDistribution */ .zS.Temurin]: {
|
||||
platforms: {
|
||||
linux: [...STANDARD_LINUX, { architecture: 'armv7', versionRange: '<18' }],
|
||||
macos: X64_ARM64,
|
||||
windows: ['x64', 'x86', 'aarch64']
|
||||
}
|
||||
},
|
||||
[_package_types_js__WEBPACK_IMPORTED_MODULE_1__/* .JavaDistribution */ .zS.Zulu]: {
|
||||
[_package_types_js__WEBPACK_IMPORTED_MODULE_2__/* .JavaDistribution */ .zS.Zulu]: {
|
||||
platforms: {
|
||||
linux: ['x64', 'x86', 'armv7', 'aarch64'],
|
||||
macos: X64_ARM64,
|
||||
windows: ['x64', 'x86', 'aarch64']
|
||||
}
|
||||
},
|
||||
[_package_types_js__WEBPACK_IMPORTED_MODULE_1__/* .JavaDistribution */ .zS.Liberica]: {
|
||||
[_package_types_js__WEBPACK_IMPORTED_MODULE_2__/* .JavaDistribution */ .zS.Liberica]: {
|
||||
platforms: {
|
||||
linux: ['x64', 'x86', 'armv7', 'aarch64', 'ppc64le'],
|
||||
macos: X64_ARM64,
|
||||
@@ -31022,31 +31027,31 @@ const JAVA_PLATFORM_CAPABILITIES = {
|
||||
solaris: ['x64']
|
||||
}
|
||||
},
|
||||
[_package_types_js__WEBPACK_IMPORTED_MODULE_1__/* .JavaDistribution */ .zS.LibericaNik]: {
|
||||
[_package_types_js__WEBPACK_IMPORTED_MODULE_2__/* .JavaDistribution */ .zS.LibericaNik]: {
|
||||
platforms: {
|
||||
linux: X64_ARM64,
|
||||
macos: X64_ARM64,
|
||||
windows: X64_ARM64
|
||||
}
|
||||
},
|
||||
[_package_types_js__WEBPACK_IMPORTED_MODULE_1__/* .JavaDistribution */ .zS.JdkFile]: {
|
||||
[_package_types_js__WEBPACK_IMPORTED_MODULE_2__/* .JavaDistribution */ .zS.JdkFile]: {
|
||||
unrestricted: true
|
||||
},
|
||||
[_package_types_js__WEBPACK_IMPORTED_MODULE_1__/* .JavaDistribution */ .zS.Microsoft]: {
|
||||
[_package_types_js__WEBPACK_IMPORTED_MODULE_2__/* .JavaDistribution */ .zS.Microsoft]: {
|
||||
platforms: {
|
||||
linux: X64_ARM64,
|
||||
macos: X64_ARM64,
|
||||
windows: X64_ARM64
|
||||
}
|
||||
},
|
||||
[_package_types_js__WEBPACK_IMPORTED_MODULE_1__/* .JavaDistribution */ .zS.Semeru]: {
|
||||
[_package_types_js__WEBPACK_IMPORTED_MODULE_2__/* .JavaDistribution */ .zS.Semeru]: {
|
||||
platforms: {
|
||||
linux: ['x64', 'x86', 'ppc64le', 'ppc64', 's390x', 'aarch64'],
|
||||
macos: X64_ARM64,
|
||||
windows: ['x64', 'aarch64']
|
||||
}
|
||||
},
|
||||
[_package_types_js__WEBPACK_IMPORTED_MODULE_1__/* .JavaDistribution */ .zS.Corretto]: {
|
||||
[_package_types_js__WEBPACK_IMPORTED_MODULE_2__/* .JavaDistribution */ .zS.Corretto]: {
|
||||
platforms: {
|
||||
linux: [
|
||||
'x64',
|
||||
@@ -31058,55 +31063,55 @@ const JAVA_PLATFORM_CAPABILITIES = {
|
||||
windows: ['x64', { architecture: 'x86', versionRange: '<12' }]
|
||||
}
|
||||
},
|
||||
[_package_types_js__WEBPACK_IMPORTED_MODULE_1__/* .JavaDistribution */ .zS.Oracle]: {
|
||||
[_package_types_js__WEBPACK_IMPORTED_MODULE_2__/* .JavaDistribution */ .zS.Oracle]: {
|
||||
platforms: {
|
||||
linux: X64_ARM64,
|
||||
macos: X64_ARM64,
|
||||
windows: ['x64']
|
||||
}
|
||||
},
|
||||
[_package_types_js__WEBPACK_IMPORTED_MODULE_1__/* .JavaDistribution */ .zS.Dragonwell]: {
|
||||
[_package_types_js__WEBPACK_IMPORTED_MODULE_2__/* .JavaDistribution */ .zS.Dragonwell]: {
|
||||
platforms: {
|
||||
linux: X64_ARM64,
|
||||
windows: ['x64']
|
||||
}
|
||||
},
|
||||
[_package_types_js__WEBPACK_IMPORTED_MODULE_1__/* .JavaDistribution */ .zS.SapMachine]: {
|
||||
[_package_types_js__WEBPACK_IMPORTED_MODULE_2__/* .JavaDistribution */ .zS.SapMachine]: {
|
||||
platforms: {
|
||||
linux: ['x64', 'aarch64', 'ppc64le'],
|
||||
macos: X64_ARM64,
|
||||
windows: X64_ARM64
|
||||
}
|
||||
},
|
||||
[_package_types_js__WEBPACK_IMPORTED_MODULE_1__/* .JavaDistribution */ .zS.GraalVM]: {
|
||||
[_package_types_js__WEBPACK_IMPORTED_MODULE_2__/* .JavaDistribution */ .zS.GraalVM]: {
|
||||
platforms: {
|
||||
linux: X64_ARM64,
|
||||
macos: X64_ARM64,
|
||||
windows: ['x64']
|
||||
}
|
||||
},
|
||||
[_package_types_js__WEBPACK_IMPORTED_MODULE_1__/* .JavaDistribution */ .zS.GraalVMCommunity]: {
|
||||
[_package_types_js__WEBPACK_IMPORTED_MODULE_2__/* .JavaDistribution */ .zS.GraalVMCommunity]: {
|
||||
platforms: {
|
||||
linux: X64_ARM64,
|
||||
macos: X64_ARM64,
|
||||
windows: ['x64']
|
||||
}
|
||||
},
|
||||
[_package_types_js__WEBPACK_IMPORTED_MODULE_1__/* .JavaDistribution */ .zS.JetBrains]: {
|
||||
[_package_types_js__WEBPACK_IMPORTED_MODULE_2__/* .JavaDistribution */ .zS.JetBrains]: {
|
||||
platforms: {
|
||||
linux: X64_ARM64,
|
||||
macos: X64_ARM64,
|
||||
windows: X64_ARM64
|
||||
}
|
||||
},
|
||||
[_package_types_js__WEBPACK_IMPORTED_MODULE_1__/* .JavaDistribution */ .zS.Kona]: {
|
||||
[_package_types_js__WEBPACK_IMPORTED_MODULE_2__/* .JavaDistribution */ .zS.Kona]: {
|
||||
platforms: {
|
||||
linux: X64_ARM64,
|
||||
macos: X64_ARM64,
|
||||
windows: ['x64']
|
||||
}
|
||||
},
|
||||
[_package_types_js__WEBPACK_IMPORTED_MODULE_1__/* .JavaDistribution */ .zS.OracleOpenJdk]: {
|
||||
[_package_types_js__WEBPACK_IMPORTED_MODULE_2__/* .JavaDistribution */ .zS.OracleOpenJdk]: {
|
||||
platforms: {
|
||||
linux: X64_ARM64,
|
||||
macos: X64_ARM64,
|
||||
@@ -31146,6 +31151,18 @@ function normalizeArchitecture(architecture) {
|
||||
function normalizePlatform(platform) {
|
||||
return PLATFORM_ALIASES[platform];
|
||||
}
|
||||
function isAlpineLinux(platform = process.platform, alpineReleaseExists) {
|
||||
return (platform === 'linux' &&
|
||||
(alpineReleaseExists ?? fs__WEBPACK_IMPORTED_MODULE_0___default().existsSync('/etc/alpine-release')));
|
||||
}
|
||||
function getJavaPlatformIdentity(platform = process.platform, alpineReleaseExists) {
|
||||
if (platform === 'linux') {
|
||||
return isAlpineLinux(platform, alpineReleaseExists)
|
||||
? 'linux-musl'
|
||||
: 'linux-glibc';
|
||||
}
|
||||
return normalizePlatform(platform) ?? platform;
|
||||
}
|
||||
function validateJavaPlatform(distributionName, platform, architecture, version) {
|
||||
const normalizedArchitecture = normalizeArchitecture(architecture);
|
||||
if (!isJavaDistribution(distributionName)) {
|
||||
@@ -31181,8 +31198,8 @@ function isVersionCompatible(version, supportedRange) {
|
||||
if (/^\d+(\.\d+){3,}$/.test(normalizedVersion)) {
|
||||
normalizedVersion = normalizeExtendedVersionToSemver(normalizedVersion);
|
||||
}
|
||||
const requestedRange = semver__WEBPACK_IMPORTED_MODULE_0___default().validRange(normalizedVersion.replace(/-ea$/, ''));
|
||||
const capabilityRange = semver__WEBPACK_IMPORTED_MODULE_0___default().validRange(supportedRange);
|
||||
const requestedRange = semver__WEBPACK_IMPORTED_MODULE_1___default().validRange(normalizedVersion.replace(/-ea$/, ''));
|
||||
const capabilityRange = semver__WEBPACK_IMPORTED_MODULE_1___default().validRange(supportedRange);
|
||||
if (!requestedRange || !capabilityRange) {
|
||||
return true;
|
||||
}
|
||||
@@ -31194,7 +31211,7 @@ function isVersionCompatible(version, supportedRange) {
|
||||
}
|
||||
return version;
|
||||
}
|
||||
return semver__WEBPACK_IMPORTED_MODULE_0___default().intersects(requestedRange, capabilityRange, {
|
||||
return semver__WEBPACK_IMPORTED_MODULE_1___default().intersects(requestedRange, capabilityRange, {
|
||||
includePrerelease: true
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user