mirror of
https://github.com/actions/setup-java.git
synced 2026-06-23 12:27:43 +00:00
Always fall back to legacy AdoptOpenJDK but log all Temurin failures
- Change error handling to gracefully fall back for all errors, not just version-not-found - Log version-not-found errors as notices with migration guidance - Log other Temurin failures as debug messages for troubleshooting - Improves resilience: users always get a result even if Temurin API has issues - Maintains visibility: failures are still logged for debugging
This commit is contained in:
parent
7d2d456be4
commit
5d3f13625c
11
dist/setup/index.js
vendored
11
dist/setup/index.js
vendored
@ -77847,16 +77847,15 @@ class AdoptDistribution extends base_installer_1.JavaBase {
|
|||||||
return yield this.temurinDistribution.findPackageForDownload(version);
|
return yield this.temurinDistribution.findPackageForDownload(version);
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
// Only fall back to legacy AdoptOpenJDK for version-not-found errors
|
// Log the failure but always fall back to legacy AdoptOpenJDK for resilience
|
||||||
if (error instanceof Error &&
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
||||||
error.message.includes('No matching version found')) {
|
if (errorMessage.includes('No matching version found')) {
|
||||||
core.notice('The JVM you are looking for could not be found in the Temurin repository, this likely indicates ' +
|
core.notice('The JVM you are looking for could not be found in the Temurin repository, this likely indicates ' +
|
||||||
'that you are using an out of date version of Java, consider updating and moving to using the Temurin distribution type in setup-java.');
|
'that you are using an out of date version of Java, consider updating and moving to using the Temurin distribution type in setup-java.');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Rethrow unexpected errors to avoid masking real issues
|
// Log other errors for debugging but gracefully fall back
|
||||||
core.debug(`Unexpected error from Temurin lookup: ${error instanceof Error ? error.message : String(error)}`);
|
core.debug(`Temurin lookup failed: ${errorMessage}. Falling back to AdoptOpenJDK API.`);
|
||||||
throw error;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -71,21 +71,18 @@ export class AdoptDistribution extends JavaBase {
|
|||||||
try {
|
try {
|
||||||
return await this.temurinDistribution.findPackageForDownload(version);
|
return await this.temurinDistribution.findPackageForDownload(version);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Only fall back to legacy AdoptOpenJDK for version-not-found errors
|
// Log the failure but always fall back to legacy AdoptOpenJDK for resilience
|
||||||
if (
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
||||||
error instanceof Error &&
|
if (errorMessage.includes('No matching version found')) {
|
||||||
error.message.includes('No matching version found')
|
|
||||||
) {
|
|
||||||
core.notice(
|
core.notice(
|
||||||
'The JVM you are looking for could not be found in the Temurin repository, this likely indicates ' +
|
'The JVM you are looking for could not be found in the Temurin repository, this likely indicates ' +
|
||||||
'that you are using an out of date version of Java, consider updating and moving to using the Temurin distribution type in setup-java.'
|
'that you are using an out of date version of Java, consider updating and moving to using the Temurin distribution type in setup-java.'
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// Rethrow unexpected errors to avoid masking real issues
|
// Log other errors for debugging but gracefully fall back
|
||||||
core.debug(
|
core.debug(
|
||||||
`Unexpected error from Temurin lookup: ${error instanceof Error ? error.message : String(error)}`
|
`Temurin lookup failed: ${errorMessage}. Falling back to AdoptOpenJDK API.`
|
||||||
);
|
);
|
||||||
throw error;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user