Support exact Corretto release versions (#1310)

* Support exact Corretto release versions

Corretto users cannot pin the release used by their local builds and
production. Accept full release numbers so a workflow keeps using its
chosen release after Amazon publishes a newer patch.

* Fix Corretto release review findings

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Bruno Borges <brborges@microsoft.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
David Phillips
2026-11-04 16:40:21 -05:00
committed by GitHub
co-authored by Copilot App Bruno Borges
parent dade0c5eef
commit 644a850ee5
8 changed files with 557 additions and 25 deletions
+14 -1
View File
@@ -31220,7 +31220,7 @@ const DISTRIBUTIONS_ONLY_MAJOR_VERSION = (/* unused pure expression or super */
/* harmony export */ Vt: () => (/* binding */ getBooleanInput),
/* harmony export */ lN: () => (/* binding */ isJdkCacheEnabled)
/* harmony export */ });
/* unused harmony exports getVersionFromToolcachePath, extractJdkFile, cacheJdkDir, getJavaVersionFromReleaseFile, getDownloadArchiveExtension, isVersionSatisfies, getToolcachePath, isGhes, getVersionFromFileContent, convertVersionToSemver, normalizeJavaVersionToSemver, getArtifactFingerprint, getGitHubToken, getGitHubHttpHeaders, MAX_PAGINATION_PAGES, getNextPageUrlFromLinkHeader, validatePaginationUrl, renameWinArchive, getLatestMajorVersion */
/* unused harmony exports getVersionFromToolcachePath, extractJdkFile, cacheJdkDir, getJavaVersionFromReleaseFile, getDownloadArchiveExtension, isVersionSatisfies, getToolcachePath, isGhes, getVersionFromFileContent, isExactCorrettoVersion, convertVersionToSemver, normalizeJavaVersionToSemver, getArtifactFingerprint, getGitHubToken, getGitHubHttpHeaders, MAX_PAGINATION_PAGES, getNextPageUrlFromLinkHeader, validatePaginationUrl, renameWinArchive, getLatestMajorVersion */
/* harmony import */ var os__WEBPACK_IMPORTED_MODULE_0__ = __nccwpck_require__(857);
/* harmony import */ var os__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nccwpck_require__.n(os__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __nccwpck_require__(6928);
@@ -31527,6 +31527,15 @@ function getVersionFromFileContent(content, distributionName, versionFile) {
}
const tentativeVersion = avoidOldNotation(capturedVersion);
const rawVersion = tentativeVersion.split('-')[0];
// Preserve Corretto's full vendor release before generic coercion drops its extra numeric fields.
if ((extractedDistribution || distributionName) === 'corretto' &&
capturedVersion === tentativeVersion &&
isExactCorrettoVersion(tentativeVersion)) {
return {
version: tentativeVersion,
distribution: extractedDistribution
};
}
let version = semver.validRange(rawVersion)
? tentativeVersion
: semver.coerce(tentativeVersion);
@@ -31610,6 +31619,10 @@ function mapAsdfDistribution(asdfDist) {
function avoidOldNotation(content) {
return content.startsWith('1.') ? content.substring(2) : content;
}
function isExactCorrettoVersion(version) {
// Java 8 releases have a nonzero update field; later releases use five numeric fields.
return /^(?:8\.(?!0+(?:\.|$))\d+(?:\.\d+){2}|(?!8\.)\d+(?:\.\d+){4})$/.test(version.replace('+', '.'));
}
function convertVersionToSemver(version) {
// Some distributions may use semver-like notation (12.10.2.1, 12.10.2.1.1)
const versionArray = Array.isArray(version) ? version : version.split('.');