Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mirror-url parameter to allow downloading Node.js from a custom URL #1211

Closed
wants to merge 26 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
error
  • Loading branch information
aparnajyothi-y committed Jan 30, 2025
commit 50efbd2a86c64b1d4ff6eced9d4f0d3148511088
6 changes: 3 additions & 3 deletions dist/setup/index.js
Original file line number Diff line number Diff line change
@@ -100205,7 +100205,7 @@ class BaseDistribution {
if (err instanceof tc.HTTPError &&
err.httpStatusCode == 404 &&
this.osPlat == 'win32') {
return yield this.acquireWindowsNodeFromFallbackLocation(info.resolvedVersion, info.arch);
return yield this.acquireWindowsNodeFromFallbackLocation(info.resolvedVersion, info.arch, info.downloadUrl);
}
core.error(`Download failed from ${info.downloadUrl}. Please check the URl and try again.`);
throw err;
@@ -100223,7 +100223,7 @@ class BaseDistribution {
return { range: valid, options };
}
acquireWindowsNodeFromFallbackLocation(version_1) {
return __awaiter(this, arguments, void 0, function* (version, arch = os_1.default.arch()) {
return __awaiter(this, arguments, void 0, function* (version, arch = os_1.default.arch(), downloadUrl) {
const initialUrl = this.getDistributionUrl();
core.info('url: ' + initialUrl);
const osArch = this.translateArchToDistUrl(arch);
@@ -100239,7 +100239,7 @@ class BaseDistribution {
exeUrl = `${initialUrl}/v${version}/win-${osArch}/node.exe`;
libUrl = `${initialUrl}/v${version}/win-${osArch}/node.lib`;
core.info(`Downloading only node binary from ${exeUrl}`);
if (!exeUrl) {
if (downloadUrl != exeUrl) {
core.error('unable to download node binary with the provided URL. Please check and try again');
}
const exePath = yield tc.downloadTool(exeUrl);
10 changes: 6 additions & 4 deletions src/distributions/base-distribution.ts
Original file line number Diff line number Diff line change
@@ -169,7 +169,8 @@ export default abstract class BaseDistribution {
) {
return await this.acquireWindowsNodeFromFallbackLocation(
info.resolvedVersion,
info.arch
info.arch,
info.downloadUrl
);
}
core.error(`Download failed from ${info.downloadUrl}. Please check the URl and try again.`);
@@ -193,11 +194,12 @@ export default abstract class BaseDistribution {

protected async acquireWindowsNodeFromFallbackLocation(
version: string,
arch: string = os.arch()
arch: string = os.arch(),
downloadUrl : string
): Promise<string> {
const initialUrl = this.getDistributionUrl();
core.info('url: ' + initialUrl);
const osArch: string = this.translateArchToDistUrl(arch);
const osArch: string = this.translateArchToDistUrl(arch);

// Create temporary folder to download to
const tempDownloadFolder = `temp_${uuidv4()}`;
@@ -212,7 +214,7 @@ export default abstract class BaseDistribution {
libUrl = `${initialUrl}/v${version}/win-${osArch}/node.lib`;

core.info(`Downloading only node binary from ${exeUrl}`);
if(!exeUrl ){core.error('unable to download node binary with the provided URL. Please check and try again');}
if(downloadUrl != exeUrl ){core.error('unable to download node binary with the provided URL. Please check and try again');}


const exePath = await tc.downloadTool(exeUrl);
Loading
Oops, something went wrong.