This commit is contained in:
Aparna Jyothi 2025-01-31 11:46:26 +05:30
parent 91a5e5da06
commit 7188cb1e62
3 changed files with 26 additions and 0 deletions

View file

@ -139,7 +139,11 @@ export default abstract class BaseDistribution {
protected getNodejsMirrorURLInfo(version: string) {
const mirrorURL = this.nodeInfo.mirrorURL;
core.info('mirrorURL from getNodejsMirrorURLInfo '+mirrorURL);
const osArch: string = this.translateArchToDistUrl(this.nodeInfo.arch);
core.info('osArch from translateArchToDistUrl '+osArch);
version = semver.clean(version) || '';
const fileName: string =
this.osPlat == 'win32'
@ -153,6 +157,7 @@ export default abstract class BaseDistribution {
: `${fileName}.tar.gz`;
const url = `${mirrorURL}/v${version}/${urlFileName}`;
core.info('url from construct '+url);
return <INodeVersionInfo>{
downloadUrl: url,

View file

@ -21,6 +21,7 @@ export default class OfficialBuilds extends BaseDistribution {
try {
core.info(`Attempting to download using mirror URL...`);
downloadPath = await this.downloadFromMirrorURL(); // Attempt to download from the mirror
core.info('downloadPath from downloadFromMirrorURL() '+ downloadPath);
if (downloadPath) {
toolPath = downloadPath;
}
@ -317,10 +318,16 @@ export default class OfficialBuilds extends BaseDistribution {
protected async downloadFromMirrorURL() {
const nodeJsVersions = await this.getMirrorUrVersions();
core.info('nodeJsVersions from getMirrorUrVersions '+nodeJsVersions);
const versions = this.filterVersions(nodeJsVersions);
core.info('versions from filterVersions '+versions);
const evaluatedVersion = this.evaluateVersions(versions);
core.info('evaluatedVersion from evaluatedVersions '+evaluatedVersion);
if (!evaluatedVersion) {
throw new Error(
`Unable to find Node version '${this.nodeInfo.versionSpec}' for platform ${this.osPlat} and architecture ${this.nodeInfo.arch}.`
@ -329,8 +336,13 @@ export default class OfficialBuilds extends BaseDistribution {
const toolName = this.getNodejsMirrorURLInfo(evaluatedVersion);
core.info('toolName from getNodejsMirrorURLInfo '+toolName);
try {
const toolPath = await this.downloadNodejs(toolName);
core.info('toolPath from downloadNodejs '+toolPath);
return toolPath;
} catch (error) {
if (error instanceof tc.HTTPError && error.httpStatusCode === 404) {