mirror of
https://github.com/actions/setup-java.git
synced 2026-11-20 03:13:05 +00:00
Report concrete versions for floating Oracle JDK downloads (#1213)
* Fix floating Oracle JDK version resolution Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Update generated distribution bundles Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Harden floating artifact cache identity Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Regenerate setup bundle after cache hardening Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Temporarily enable hosted full validation Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Export hosted formatting results Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Apply repository formatting Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Run hosted validation after formatting Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Correct floating version regression tests Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Remove temporary validation wiring Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Cache checksum-less floating artifacts by their response fingerprint Oracle and Oracle GraalVM do not always publish a `.sha256` sibling next to a `/latest/` artifact. Those floating releases were excluded from both the resolution cache and the JDK cache, so `cache-jdk` users lost caching entirely for them. A floating URL is a constant string, so it cannot serve as a cache identity on its own — a stale entry would be reused forever. Instead, derive a validator from the headers of the HEAD request that already resolves the artifact: the ETag when present, otherwise `Last-Modified` combined with `Content-Length`. Republishing changes the validator, which changes the cache key, so a new build is downloaded rather than masked. `getJdkReleaseIdentity` now falls back to that fingerprint before the URL, and the floating cache gates ask whether the release has a stable identity (checksum or fingerprint) rather than a checksum specifically. A floating release with neither is still left uncached. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Co-authored-by: Bruno Borges <brborges@microsoft.com>
This commit is contained in:
@@ -12,7 +12,9 @@ import {
|
||||
import {
|
||||
cacheJdkDir,
|
||||
extractJdkFile,
|
||||
getArtifactFingerprint,
|
||||
getDownloadArchiveExtension,
|
||||
getJavaVersionFromReleaseFile,
|
||||
getLatestMajorVersion,
|
||||
renameWinArchive
|
||||
} from '../../util.js';
|
||||
@@ -43,7 +45,10 @@ export class OracleDistribution extends JavaBase {
|
||||
|
||||
const archiveName = fs.readdirSync(extractedJavaPath)[0];
|
||||
const archivePath = path.join(extractedJavaPath, archiveName);
|
||||
const version = this.getToolcacheVersionName(javaRelease.version);
|
||||
const installedVersion = javaRelease.floating
|
||||
? getJavaVersionFromReleaseFile(archivePath)
|
||||
: javaRelease.version;
|
||||
const version = this.getToolcacheVersionName(installedVersion);
|
||||
|
||||
const javaPath = await cacheJdkDir(
|
||||
archivePath,
|
||||
@@ -52,7 +57,11 @@ export class OracleDistribution extends JavaBase {
|
||||
this.architecture
|
||||
);
|
||||
|
||||
return {version: javaRelease.version, path: javaPath};
|
||||
return {version: installedVersion, path: javaPath};
|
||||
}
|
||||
|
||||
protected requiresRemoteResolution(): boolean {
|
||||
return this.stable && !this.version.includes('.');
|
||||
}
|
||||
|
||||
protected async findPackageForDownload(
|
||||
@@ -113,11 +122,15 @@ export class OracleDistribution extends JavaBase {
|
||||
const response = await this.http.head(url);
|
||||
|
||||
if (response.message.statusCode === HttpCodes.OK) {
|
||||
const floating = url === floatingUrl;
|
||||
return {
|
||||
url,
|
||||
version: range,
|
||||
checksum: await this.fetchChecksum(`${url}.sha256`, 'sha256'),
|
||||
floating: url === floatingUrl
|
||||
floating,
|
||||
fingerprint: floating
|
||||
? getArtifactFingerprint(response.message.headers)
|
||||
: undefined
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user