Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/Agent.Sdk/Knob/AgentKnobs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,13 @@ public class AgentKnobs
new EnvironmentKnobSource("AGENT_DISABLE_NODE6_TASKS"),
new BuiltInDefaultKnobSource("false"));

public static readonly Knob EnableEOLNodeVersionPolicy = new Knob(
nameof(EnableEOLNodeVersionPolicy),
"When enabled, automatically upgrades tasks using end-of-life Node.js versions (6, 10, 16) to supported versions (Node 20.1 or Node 24). Throws error if no supported versions are available on the agent.",
new PipelineFeatureSource("AGENT_RESTRICT_EOL_NODE_VERSIONS"),
new EnvironmentKnobSource("AGENT_RESTRICT_EOL_NODE_VERSIONS"),
new BuiltInDefaultKnobSource("false"));

public static readonly Knob DisableTeePluginRemoval = new Knob(
nameof(DisableTeePluginRemoval),
"Disables removing TEE plugin after using it during checkout.",
Expand Down Expand Up @@ -929,5 +936,12 @@ public class AgentKnobs
new PipelineFeatureSource("EnableDockerExecDiagnostics"),
new EnvironmentKnobSource("AGENT_ENABLE_DOCKER_EXEC_DIAGNOSTICS"),
new BuiltInDefaultKnobSource("false"));

public static readonly Knob UseUnifiedNodeVersionStrategy = new Knob(
nameof(UseUnifiedNodeVersionStrategy),
"If true, use the unified strategy pattern for Node.js version selection (both host and container). This provides centralized node selection logic with EOL policy enforcement. Set to false to use legacy node selection logic.",
new PipelineFeatureSource("UseUnifiedNodeVersionStrategy"),
new EnvironmentKnobSource("AGENT_USE_UNIFIED_NODE_STRATEGY"),
new BuiltInDefaultKnobSource("false"));
}
}
17 changes: 17 additions & 0 deletions src/Test/L0/NodeHandlerCollections.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using Xunit;

namespace Microsoft.VisualStudio.Services.Agent.Tests
{
/// <summary>
/// Single collection for ALL NodeHandler tests (legacy and unified).
/// This ensures sequential execution to prevent environment variable conflicts.
/// </summary>
[CollectionDefinition("Unified NodeHandler Tests")]
public class UnifiedNodeHandlerTestFixture : ICollectionFixture<UnifiedNodeHandlerTestFixture>
{
// This class is never instantiated, it's just a collection marker
}
}
32 changes: 32 additions & 0 deletions src/Test/L0/NodeHandlerL0.AllSpecs.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System.Linq;
using Xunit;

namespace Microsoft.VisualStudio.Services.Agent.Tests
{
/// <summary>
/// Unified test runner for ALL NodeHandler test specifications.
/// Executes every scenario defined in NodeHandlerTestSpecs.AllScenarios.
/// </summary>
[Trait("Level", "L0")]
[Trait("Category", "NodeHandler")]
[Collection("Unified NodeHandler Tests")]
public sealed class NodeHandlerL0AllSpecs : NodeHandlerTestBase
{
[Theory]
[MemberData(nameof(GetAllNodeHandlerScenarios))]
public void NodeHandler_AllScenarios(TestScenario scenario)
{
RunScenarioAndAssert(scenario);
}

public static object[][] GetAllNodeHandlerScenarios()
{
return NodeHandlerTestSpecs.AllScenarios
.Select(scenario => new object[] { scenario })
.ToArray();
}
}
}
Loading