Skip to content

Enhancement: Add support for configurable Node.js binary mirror sources#22043

Merged
tarunramsinghani merged 20 commits intomasterfrom
copilot/migrate-pull-request-from-fork
Apr 24, 2026
Merged

Enhancement: Add support for configurable Node.js binary mirror sources#22043
tarunramsinghani merged 20 commits intomasterfrom
copilot/migrate-pull-request-from-fork

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 23, 2026

Context

This PR brings in the changes from issue #21267, which requested the ability to use a custom Node.js download mirror in the UseNodeV1 task — useful for restricted networks, private artifact caches, or alternative mirrors.

The commits were originally authored in fork-based PR #21960 by @uychagas. This PR migrates the full commit history into an in-repository branch so that review and merge can proceed in-repo while preserving original author attribution.


Task Name

UseNodeV1


Description

Adds a new advanced input nodejsMirror to the UseNodeV1 task:

  • nodejsMirror (string, advanced, default https://nodejs.org/dist): specifies an alternative base URL for Node.js binaries and the version index.
  • Both the index.json version resolution request and the binary download URL are now constructed using nodejsMirror instead of the hardcoded https://nodejs.org/dist.
  • Invalid mirror URLs are rejected early with a task failure and a new localised error message (InvalidNodejsMirror).
  • The mirror URL is normalised to always carry a trailing slash before use.
  • English localisation strings (resources.resjson) updated with the new input label/help text and the new error message key.
  • task.json and task.loc.json updated with the new input definition and version bump to 1.273.0.

Backward compatibility is fully preserved: when nodejsMirror is not set, the default value (https://nodejs.org/dist) is used, so existing pipelines are unaffected.


Risk Assessment (Medium)

  • URL construction for both version resolution and binary download is affected.
  • Backward compatible: the default mirror is unchanged unless users explicitly configure nodejsMirror.
  • A user providing an invalid or unreachable URL will cause the task to fail with a clear error message.

Change Behind Feature Flag (Yes)

Controlled via the new nodejsMirror task input. Default behavior is unchanged; the custom-mirror code path is opt-in and requires an explicit non-default value.


Tech Design / Approach

  • A normalizeMirrorUrl helper in installer.ts validates and normalises the mirror URL (ensures trailing slash, rejects invalid URLs).
  • queryLatestMatch and acquireNode each receive nodejsMirror as a parameter instead of relying on a hardcoded constant, keeping the change minimal and auditable.
  • No new dependencies introduced; existing typed-rest-client and azure-pipelines-tool-lib are used as before.

Documentation Changes Required (Yes)

Task documentation should be updated to describe the new nodejsMirror input:

  • What it is and when to use it.
  • Expected mirror structure (Node.js dist-like layout with an index.json and versioned archives).
  • Example YAML configuration.

Unit Tests Added or Updated (Yes)

  • New test runner file Tasks/UseNodeV1/Tests/L0CustomMirror.ts validates that both the index.json request and the binary download use the custom mirror URL.
  • Tasks/UseNodeV1/Tests/L0.ts updated with a new test case Uses custom nodejsMirror for index.json and download.

Additional Testing Performed

No additional manual or integration testing performed as part of this migration PR. CI test results should be relied upon.


Logging Added/Updated (No)

No new log statements added.

  • Appropriate log statements are added with meaningful messages.
  • Logging does not expose sensitive data.
  • Log levels are used correctly (e.g., info, warn, error).

Telemetry Added/Updated (No)

No telemetry changes included.

  • Custom telemetry (e.g., counters, timers, error tracking) is added as needed.
  • Events are tagged with proper metadata for filtering and analysis.
  • Telemetry is validated in staging or test environments.

Rollback Scenario and Process (Yes)

Revert this PR to restore the prior behavior (default upstream mirror only). Pipelines that had set nodejsMirror would need to remove that input after reverting.

  • Rollback plan is documented.

Dependency Impact Assessed and Regression Tested (No)

No new or updated dependencies. The package-lock.json changes reflect a dependency tree normalisation only (no version changes to direct dependencies).

  • All impacted internal modules, APIs, services, and third-party libraries are analyzed.
  • Results are reviewed and confirmed to not break existing functionality.

Checklist

  • Related issue linked (if applicable)
  • Task version was bumped — see versioning guide
  • Verified the task behaves as expected

uychagas and others added 20 commits April 6, 2026 20:26
Expanded the task to allow using custom Node.js binary mirror sources via the "nodejsMirror" input. Updated relevant localization resources and adjusted installation logic to utilize the specified mirror.
Co-authored-by: tarunramsinghani <2929463+tarunramsinghani@users.noreply.github.com>
@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines:
3 pipeline(s) require an authorized user to comment /azp run to run.

Copilot AI requested a review from tarunramsinghani April 23, 2026 07:47
@tarunramsinghani tarunramsinghani changed the title Migrate #21960 from fork branch to repository branch Enhancement: Add support for configurable Node.js binary mirror sources Apr 23, 2026
@tarunramsinghani tarunramsinghani marked this pull request as ready for review April 23, 2026 08:29
@tarunramsinghani tarunramsinghani requested a review from a team as a code owner April 23, 2026 08:29
@tarunramsinghani
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines:
Successfully started running 3 pipeline(s).

1 similar comment
@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines:
Successfully started running 3 pipeline(s).

@tarunramsinghani tarunramsinghani merged commit 01cb7bf into master Apr 24, 2026
15 checks passed
@tarunramsinghani tarunramsinghani deleted the copilot/migrate-pull-request-from-fork branch April 24, 2026 09:37
@uychagas
Copy link
Copy Markdown
Contributor

@tarunramsinghani sorry, it's my first contribuition to this repo, so I see that I'm not added as repo contributor, is it expected?

@uychagas
Copy link
Copy Markdown
Contributor

@tarunramsinghani sorry, it's my first contribuition to this repo, so I see that I'm not added as repo contributor, is it expected?

@rishabhmalikMS or @tarunramsinghani just for understanding the contribuite flow here. :)

@tarunramsinghani
Copy link
Copy Markdown
Collaborator

@uychagas, The contributor permissions are limited to repo. For any contributions please continue to use forked repo. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants