Skip to content

Commit a4c8755

Browse files
authored
Use node20_1 for sleepCommand when running container (#4929)
1 parent f9260a0 commit a4c8755

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

src/Agent.Sdk/Knob/AgentKnobs.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,13 @@ public class AgentKnobs
654654
new PipelineFeatureSource("CheckIfTaskNodeRunnerIsDeprecated"),
655655
new BuiltInDefaultKnobSource("false"));
656656

657+
public static readonly Knob UseNode20ToStartContainer = new Knob(
658+
nameof(UseNode20ToStartContainer),
659+
"If true, the agent will use Node 20 to start docker container when executing container job and the container platform is the same as the host platform.",
660+
new RuntimeKnobSource("AZP_AGENT_USE_NODE20_TO_START_CONTAINER"),
661+
new PipelineFeatureSource("UseNode20ToStartContainer"),
662+
new BuiltInDefaultKnobSource("false"));
663+
657664
public static readonly Knob EnableNewSecretMasker = new Knob(
658665
nameof(EnableNewSecretMasker),
659666
"If true, the agent will use new SecretMasker with additional filters & performance enhancements",

src/Agent.Worker/ContainerOperationProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ private async Task StartContainerAsync(IExecutionContext executionContext, Conta
539539
}
540540
else
541541
{
542-
node = container.TranslateToContainerPath(Path.Combine(HostContext.GetDirectory(WellKnownDirectory.Externals), "node", "bin", $"node{IOUtil.ExeExtension}"));
542+
node = container.TranslateToContainerPath(Path.Combine(HostContext.GetDirectory(WellKnownDirectory.Externals), AgentKnobs.UseNode20ToStartContainer.GetValue(executionContext).AsBoolean() ? NodeHandler.Node20_1Folder : NodeHandler.NodeFolder, "bin", $"node{IOUtil.ExeExtension}"));
543543

544544
// if on Mac OS X, require container to have node
545545
if (PlatformUtil.RunningOnMacOS)

src/Agent.Worker/Handlers/NodeHandler.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
using System.Linq;
1414
using System.Collections.Generic;
1515
using System.Threading;
16-
using Microsoft.TeamFoundation.Common.Internal;
17-
using Microsoft.VisualStudio.Services.Agent.Worker.Telemetry;
18-
using Newtonsoft.Json;
1916
using StringUtil = Microsoft.VisualStudio.Services.Agent.Util.StringUtil;
2017

2118
namespace Microsoft.VisualStudio.Services.Agent.Worker.Handlers

0 commit comments

Comments
 (0)