Skip to content
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

Fix Node runner deprecation check #4969

Merged
merged 6 commits into from
Aug 30, 2024
Merged
Changes from 4 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
22 changes: 17 additions & 5 deletions src/Agent.Worker/TaskManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -375,23 +375,35 @@ private void CheckIfTaskNodeRunnerIsDeprecated(IExecutionContext executionContex
{
string[] deprecatedNodeRunners = { "Node", "Node10" };
string[] approvedNodeRunners = { "Node16", "Node20_1" }; // Node runners which are not considered as deprecated
string[] executionSteps = { "prejobexecution", "execution", "postjobexecution" };

JObject taskJson = GetTaskJson(task);
var taskRunners = (JObject)taskJson["execution"];

foreach (string runner in approvedNodeRunners)
var taskRunners = new HashSet<string>();

foreach (var step in executionSteps)
{
if (taskRunners.ContainsKey(runner))
var runners = taskJson.GetValueOrDefault(step);
if (runners == null)
{
return; // Agent never uses deprecated Node runners if there are approved Node runners
continue;
}

var runnerNames = ((JObject)runners).Properties().Select(p => p.Name);

if (runnerNames.Intersect(approvedNodeRunners).Any())
{
continue; // Agent never uses deprecated Node runners if there are approved Node runners
}

taskRunners.Add(runnerNames);
}

List<string> taskNodeRunners = new(); // If we are here and task has Node runners, all of them are deprecated

foreach (string runner in deprecatedNodeRunners)
{
if (taskRunners.ContainsKey(runner))
if (taskRunners.Contains(runner))
{
switch (runner)
{
Expand Down
Loading