-
Notifications
You must be signed in to change notification settings - Fork 915
Fix fallback logic when the agent don't have node handler installed #5461
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
base: master
Are you sure you want to change the base?
Conversation
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
| } | ||
|
|
||
| // Handle Node24 tasks as fallback when Node24Strategy and Node20Strategy returned null | ||
| if (hasNode24Handler) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this required here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed
| return result; | ||
| } | ||
|
|
||
| private bool IsNodeFolderExist(string nodeFolderName, IExecutionContext executionContext) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this be part of some helper class as this is required in all strategy classes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
used the already implemented method for checking existence of node folder
| return File.Exists(nodePath); | ||
| } | ||
|
|
||
| private void PublishNodeFallbackTelemetry(IExecutionContext executionContext, string requestedNodeVersion, string fallbackReason, TaskContext context, string fallbackNodeVersion = null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should also be part of some helper class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used the telemetry class used in the main orchestrator file
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
39e519c to
950edf2
Compare
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
|
||
| [ServiceLocator(Default = typeof(NodeHandlerHelper))] | ||
| public interface INodeHandlerHelper | ||
| public interface INodeHandlerHelper : IAgentService |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this added here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checking this change if we can implement it in some other way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made the changes but to avoid the testcases to fail I have created a new interface in the file INodeExistenceChecker.cs in which we have defined the method to check the node folder exists or not. Like in this way when the test cases will call this method then this will return true always because the test cases always expect to return true for node folder availability check.
… during Node24 strategy
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Context
This PR addresses a Node.js version fallback issue on platforms where certain Node versions are not available (e.g., win-x86 where Node24 binaries are not shipped). Currently, when a task requests Node24 but the binary doesn't exist on the platform, the agent fails instead of gracefully falling back to an available Node version (Node20 or Node16).
Related repair-item: AB#2351680
Description
Risk Assessment (Low / Medium / High)
Medium
Unit Tests Added or Updated (Yes / No)
Updated NodeHandlerTestBase.cs to register INodeHandlerHelper mock via SetSingleton, enabling proper testing of Node24 fallback scenarios when the Node24 binary is not available on certain platforms (e.g., win-x86).
Additional Testing Performed
Manually tested the scenario in iwin-x64 machine without node 24 and the fallback is happening as expected:

Change Behind Feature Flag (Yes / No)
Can this change be behine feature flag, if not why?
Tech Design / Approach
Documentation Changes Required (Yes/No)
No
Logging Added/Updated (Yes/No)
Yes
Debug logs added for fallback decision points (e.g., "[Node24Strategy] Node24 binary not available on this platform, returning null for fallback")
Telemetry Added/Updated (Yes/No)
Yes
New fallback telemetry published via PublishNodeFallbackTelemetry() includes:
RequestedNodeVersion - The originally requested Node version
FallbackNodeVersion - The version being used instead
FallbackReason - Why fallback occurred (NodeNotAvailable, GlibCError)
Architecture - Process architecture (x86, x64, ARM64)
, OSName, OSVersion - Platform information
Strategy - Which strategy handled the fallback
JobId, PlanId, AgentName, AgentVersion, IsSelfHosted
Rollback Scenario and Process (Yes/No)
Revert to older agent versions or revert the changes in the code and release a new agent.
Dependency Impact Assessed and Regression Tested (Yes/No)