Fallback logic

This commit is contained in:
HarithaVattikuti 2024-12-25 18:47:48 -06:00
parent 0126ca49f0
commit 2984211dcd
2 changed files with 24 additions and 4 deletions

9
dist/setup/index.js vendored
View File

@ -71264,7 +71264,13 @@ class DotnetVersionResolver {
allowRetries: true, allowRetries: true,
maxRetries: 3 maxRetries: 3
}); });
const response = yield httpClient.getJson(DotnetVersionResolver.DotNetCoreIndexUrl); let response;
try {
response = yield httpClient.getJson(DotnetVersionResolver.DotNetCoreIndexUrl);
}
catch (error) {
response = yield httpClient.getJson(DotnetVersionResolver.DotnetCoreIndexFallbackUrl);
}
const result = response.result || {}; const result = response.result || {};
const releasesInfo = result['releases-index']; const releasesInfo = result['releases-index'];
const releaseInfo = releasesInfo.find(info => { const releaseInfo = releasesInfo.find(info => {
@ -71280,6 +71286,7 @@ class DotnetVersionResolver {
} }
exports.DotnetVersionResolver = DotnetVersionResolver; exports.DotnetVersionResolver = DotnetVersionResolver;
DotnetVersionResolver.DotNetCoreIndexUrl = 'https://builds.dotnet.microsoft.com/dotnet/release-metadata/releases-index.json'; DotnetVersionResolver.DotNetCoreIndexUrl = 'https://builds.dotnet.microsoft.com/dotnet/release-metadata/releases-index.json';
DotnetVersionResolver.DotnetCoreIndexFallbackUrl = 'https://dotnetcli.azureedge.net/dotnet/release-metadata/releases-index.json';
class DotnetCoreInstaller { class DotnetCoreInstaller {
constructor(version, quality) { constructor(version, quality) {
this.version = version; this.version = version;

View File

@ -101,9 +101,18 @@ export class DotnetVersionResolver {
allowRetries: true, allowRetries: true,
maxRetries: 3 maxRetries: 3
}); });
const response = await httpClient.getJson<any>(
DotnetVersionResolver.DotNetCoreIndexUrl let response;
); try {
response = await httpClient.getJson<any>(
DotnetVersionResolver.DotNetCoreIndexUrl
);
} catch (error) {
response = await httpClient.getJson<any>(
DotnetVersionResolver.DotnetCoreIndexFallbackUrl
);
}
const result = response.result || {}; const result = response.result || {};
const releasesInfo: any[] = result['releases-index']; const releasesInfo: any[] = result['releases-index'];
@ -123,6 +132,10 @@ export class DotnetVersionResolver {
static DotNetCoreIndexUrl = static DotNetCoreIndexUrl =
'https://builds.dotnet.microsoft.com/dotnet/release-metadata/releases-index.json'; 'https://builds.dotnet.microsoft.com/dotnet/release-metadata/releases-index.json';
static DotnetCoreIndexFallbackUrl =
'https://dotnetcli.azureedge.net/dotnet/release-metadata/releases-index.json';
} }
export class DotnetCoreInstaller { export class DotnetCoreInstaller {