Skip to content

Commit 4b20f2b

Browse files
committed
Merge branch 'master' into feature/dependabot
2 parents 52b5328 + 5ca134a commit 4b20f2b

File tree

4 files changed

+47
-30
lines changed

4 files changed

+47
-30
lines changed

src/Agent.Worker/ContainerOperationProvider.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -977,7 +977,8 @@ string useDoubleQuotes(string value)
977977
);
978978
}
979979
}
980-
else if (!useNode20InUnsupportedSystem)
980+
981+
if (!useNode20InUnsupportedSystem && (useNode24InUnsupportedSystem || container.NeedsNode20Redirect))
981982
{
982983
var node20 = container.TranslateToContainerPath(Path.Combine(HostContext.GetDirectory(WellKnownDirectory.Externals), NodeHandler.Node20_1Folder, "bin", $"node{IOUtil.ExeExtension}"));
983984

src/Agent.Worker/Handlers/NodeHandler.cs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ public async Task RunAsync()
210210
supportsNode20 = !node20ResultsInGlibCErrorHost;
211211
}
212212
}
213+
213214
if (!useNode24InUnsupportedSystem)
214215
{
215216
if (supportsNode24.HasValue)
@@ -374,7 +375,7 @@ public string GetNodeLocation(bool node20ResultsInGlibCError, bool node24Results
374375
string useNodeKnob = AgentKnobs.UseNode.GetValue(ExecutionContext).AsString();
375376

376377
string nodeFolder = NodeHandler.NodeFolder;
377-
if (taskHasNode24Data)
378+
if (taskHasNode24Data && useNode24)
378379
{
379380
Trace.Info($"Task.json has node24 handler data: {taskHasNode24Data}");
380381
nodeFolder = GetNodeFolderWithFallback(NodeHandler.Node24Folder, node20ResultsInGlibCError, node24ResultsInGlibCError, inContainer);
@@ -400,12 +401,7 @@ public string GetNodeLocation(bool node20ResultsInGlibCError, bool node24Results
400401
nodeFolder = NodeHandler.node10Folder;
401402
}
402403

403-
if (useNode24)
404-
{
405-
Trace.Info($"Found UseNode24 knob, using node24 for node tasks: {useNode24}");
406-
nodeFolder = GetNodeFolderWithFallback(NodeHandler.Node24Folder, node20ResultsInGlibCError, node24ResultsInGlibCError, inContainer);
407-
}
408-
else if (useNode20_1)
404+
if (useNode20_1)
409405
{
410406
Trace.Info($"Found UseNode20_1 knob, using node20_1 for node tasks {useNode20_1} node20ResultsInGlibCError = {node20ResultsInGlibCError}");
411407
nodeFolder = GetNodeFolderWithFallback(NodeHandler.Node20_1Folder, node20ResultsInGlibCError, node24ResultsInGlibCError, inContainer);

src/Misc/externals.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,12 @@ if [[ "$PACKAGERUNTIME" == "win-x"* ]]; then
176176
acquireExternalTool "$CONTAINER_URL/azcopy/1/azcopy.zip" azcopy
177177
acquireExternalTool "$CONTAINER_URL/vstshost/m122_887c6659_binding_redirect_patched/vstshost.zip" vstshost
178178
fi
179+
# Node.js dropped official support for Windows 32-bit (win-x86) starting with Node.js 20
180+
# See: https://github.com/nodejs/node/blob/main/BUILDING.md#platform-list
181+
# Node 24 is not available for win-x86, so we exclude it for this runtime
179182
if [[ "$PACKAGERUNTIME" == "win-x86" ]]; then
180183
INCLUDE_NODE24=false
184+
echo "INFO: Node 24 is not available for win-x86. Node-based tasks will fall back to Node 20 or Node 16."
181185
fi
182186

183187
acquireExternalTool "$CONTAINER_URL/mingit/${MINGIT_VERSION}/MinGit-${MINGIT_VERSION}-${BIT}-bit.zip" git

src/Test/L0/NodeHandlerL0.cs

Lines changed: 38 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -71,31 +71,47 @@ public void UseNewNodeForNewNodeHandler(string nodeVersion)
7171
{
7272
ResetNodeKnobs();
7373

74-
// Use a unique test name per data row to avoid sharing the same trace file across parallel runs
75-
using (TestHostContext thc = CreateTestHostContext($"{nameof(UseNewNodeForNewNodeHandler)}_{nodeVersion}"))
74+
// For node24, set the required knob
75+
if (nodeVersion == "node24")
7676
{
77-
thc.SetSingleton(new WorkerCommandManager() as IWorkerCommandManager);
78-
thc.SetSingleton(new ExtensionManager() as IExtensionManager);
79-
80-
NodeHandler nodeHandler = new NodeHandler(nodeHandlerHalper.Object);
77+
Environment.SetEnvironmentVariable("AGENT_USE_NODE24", "true");
78+
}
8179

82-
nodeHandler.Initialize(thc);
83-
nodeHandler.ExecutionContext = CreateTestExecutionContext(thc);
84-
nodeHandler.Data = nodeVersion switch
80+
try
81+
{
82+
// Use a unique test name per data row to avoid sharing the same trace file across parallel runs
83+
using (TestHostContext thc = CreateTestHostContext($"{nameof(UseNewNodeForNewNodeHandler)}_{nodeVersion}"))
8584
{
86-
"node10" => new Node10HandlerData(),
87-
"node16" => new Node16HandlerData(),
88-
"node20_1" => new Node20_1HandlerData(),
89-
"node24" => new Node24HandlerData(),
90-
_ => throw new Exception("Invalid node version"),
91-
};
85+
thc.SetSingleton(new WorkerCommandManager() as IWorkerCommandManager);
86+
thc.SetSingleton(new ExtensionManager() as IExtensionManager);
9287

93-
string actualLocation = nodeHandler.GetNodeLocation(node20ResultsInGlibCError: false, node24ResultsInGlibCError: false, inContainer: false);
94-
string expectedLocation = Path.Combine(thc.GetDirectory(WellKnownDirectory.Externals),
95-
nodeVersion,
96-
"bin",
97-
$"node{IOUtil.ExeExtension}");
98-
Assert.Equal(expectedLocation, actualLocation);
88+
NodeHandler nodeHandler = new NodeHandler(nodeHandlerHalper.Object);
89+
90+
nodeHandler.Initialize(thc);
91+
nodeHandler.ExecutionContext = CreateTestExecutionContext(thc);
92+
nodeHandler.Data = nodeVersion switch
93+
{
94+
"node10" => new Node10HandlerData(),
95+
"node16" => new Node16HandlerData(),
96+
"node20_1" => new Node20_1HandlerData(),
97+
"node24" => new Node24HandlerData(),
98+
_ => throw new Exception("Invalid node version"),
99+
};
100+
101+
string actualLocation = nodeHandler.GetNodeLocation(node20ResultsInGlibCError: false, node24ResultsInGlibCError: false, inContainer: false);
102+
string expectedLocation = Path.Combine(thc.GetDirectory(WellKnownDirectory.Externals),
103+
nodeVersion,
104+
"bin",
105+
$"node{IOUtil.ExeExtension}");
106+
Assert.Equal(expectedLocation, actualLocation);
107+
}
108+
}
109+
finally
110+
{
111+
if (nodeVersion == "node24")
112+
{
113+
Environment.SetEnvironmentVariable("AGENT_USE_NODE24", null);
114+
}
99115
}
100116
}
101117

@@ -477,4 +493,4 @@ private void ResetNodeKnobs()
477493
Environment.SetEnvironmentVariable("AGENT_USE_NODE24_IN_UNSUPPORTED_SYSTEM", null);
478494
}
479495
}
480-
}
496+
}

0 commit comments

Comments
 (0)