mirror of
https://gitea.com/actions/setup-java.git
synced 2026-11-30 18:59:06 +08: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:
20 files changed
+1037
-66
No files matched your search
@@ -25,6 +25,12 @@ export interface JdkResolutionRequest {
|
||||
architecture: string;
|
||||
versionSpec: string;
|
||||
stable: boolean;
|
||||
/**
|
||||
* Immutable identity of a remotely resolved artifact. When present, even an
|
||||
* older cache bucket is safe to reuse because changed bytes produce a
|
||||
* different request identity.
|
||||
*/
|
||||
source?: string;
|
||||
}
|
||||
|
||||
export interface RestoredJdkResolution {
|
||||
@@ -210,7 +216,8 @@ function getResolutionIdentity(request: JdkResolutionRequest): string {
|
||||
packageType: request.packageType.toLowerCase(),
|
||||
architecture: request.architecture.toLowerCase(),
|
||||
versionSpec: request.versionSpec,
|
||||
stable: request.stable
|
||||
stable: request.stable,
|
||||
source: request.source
|
||||
});
|
||||
return createHash('sha256').update(identity).digest('hex');
|
||||
}
|
||||
@@ -257,6 +264,7 @@ function parseResolvedRelease(contents: string): JavaDownloadRelease {
|
||||
const version = candidate['version'];
|
||||
const url = candidate['url'];
|
||||
const signatureUrl = candidate['signatureUrl'];
|
||||
const floating = candidate['floating'];
|
||||
|
||||
if (typeof version !== 'string' || !version) {
|
||||
throw new Error('The cached resolution has no version.');
|
||||
@@ -265,6 +273,9 @@ function parseResolvedRelease(contents: string): JavaDownloadRelease {
|
||||
if (signatureUrl !== undefined) {
|
||||
assertHttpsUrl(signatureUrl, 'signatureUrl');
|
||||
}
|
||||
if (floating !== undefined && typeof floating !== 'boolean') {
|
||||
throw new Error('The cached resolution has an invalid floating flag.');
|
||||
}
|
||||
|
||||
const release: JavaDownloadRelease = {
|
||||
version,
|
||||
@@ -273,6 +284,9 @@ function parseResolvedRelease(contents: string): JavaDownloadRelease {
|
||||
if (signatureUrl !== undefined) {
|
||||
release.signatureUrl = signatureUrl as string;
|
||||
}
|
||||
if (floating !== undefined) {
|
||||
release.floating = floating as boolean;
|
||||
}
|
||||
|
||||
const checksum = candidate['checksum'];
|
||||
if (checksum !== undefined) {
|
||||
|
||||
Reference in new issue
Block a user