Skip to content

Conversation

@rishabhmalikMS
Copy link
Contributor

@rishabhmalikMS rishabhmalikMS commented Dec 8, 2025

Context

This PR introduces the unified Node.js version selection strategy framework as part of modernizing Azure Pipelines Agent's Node.js handling. This is the first implementation step following comprehensive test specifications established in previous work. The strategy pattern provides a foundation for implementing EOL (End-of-Life) Node.js version policies andnode handler selection across both host and container environments.

Related Work: This builds on test specifications for Node Handler behavior and enables future EOL policy enforcement and unified node selection logic.

Workitem: AB#2339020


Description

Implemented comprehensive strategy pattern for Node.js version selection with the following components:

Core Strategy Framework:

  • IUnifiedNodeVersionStrategy.cs - Strategy interface defining CanHandle() and GetNodePath() contracts
  • UnifiedNodeContext.cs - Unified context model containing environment state, glibc compatibility flags, and handler data
  • NodePathResult.cs - Result model with node path, version, selection reason, and optional warnings

Strategy Implementations:

  1. UnifiedNode24Strategy.cs - Latest Node24 support with glibc fallback logic and EOL policy compliance
  2. UnifiedNode20Strategy.cs - Current default Node20 with glibc error handling
  3. UnifiedNode16Strategy.cs - Legacy Node16 support with EOL warnings
  4. UnifiedNode10Strategy.cs - Node10 support for Alpine compatibility with EOL policies
  5. UnifiedNode6Strategy.cs - Legacy Node6 support with EOL enforcement

Key Features:

  • EOL Policy Support - Configurable blocking of end-of-life Node.js versions via AGENT_ENABLE_EOL_NODE_VERSION_POLICY
  • Glibc Compatibility - Automatic fallback handling for Node20/24 glibc errors (requires glibc 2.17+/2.28+)
  • Container/Host Unification - Single strategy pattern works for both container and host execution
  • Priority-Based Selection - Strategies evaluated in optimal order: Node24 → Node20 → Node16 → Node10 → Node6
  • Comprehensive Logging - Detailed debug output for selection decisions and fallback reasoning

Risk Assessment (Low / Medium / High)

Low Risk - This PR introduces only new strategy implementation code without modifying existing NodeHandler logic. The strategies remain dormant until integrated via the feature flag in subsequent PRs. All existing NodeHandler behavior continues unchanged.


Unit Tests Added or Updated (Yes / No)

  • No unit tests added in this PR. Test infrastructure and comprehensive scenario validation will be implemented in subsequent integration PR to validate equivalence between legacy and unified strategies.
  • Previous PR #5421 has covered all scenarios for both legacy testing. The same tests will be run on the new implementation once integration is completed to ensure behavior is intact and as per expectations where is it suppoed to differ.
  • Further, additional tests will be added for equivalency and divergence to ensure legacy and unified appraoch works as per expectations. These will utilize the exisitng test scenarios we have added as a part of PR: #5421

Additional Testing Performed

List manual or automated tests performed beyond unit tests (e.g., integration, scenario, regression).


Change Behind Feature Flag (Yes / No)

Yes - The unified strategy framework will be activated via a feature flag in the integration PR (to be shared). This allows for safe rollback and testing between legacy and unified approaches.


Tech Design / Approach


Documentation Changes Required (Yes/No)


Logging Added/Updated (Yes/No)

  • Yes. Appropriate logs have been added.

Telemetry Added/Updated (Yes/No)

  • 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/No)

  • Rollback plan is documented.

Dependency Impact Assessed and Regression Tested (Yes/No)

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

…or node strategy and response data models for each strategy result
@rishabhmalikMS
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@rishabhmalikMS rishabhmalikMS changed the title Adding Strategies for node 24 to node 6 | Adding Interfaces created f… Add unified Node.js version selection strategy framework with EOL policy support Dec 8, 2025
@rishabhmalikMS
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants