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

Added knob to break pipeline unless user opt-in #4165

Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/Agent.Sdk/Knob/AgentKnobs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,13 @@ public class AgentKnobs
"Disable agent downgrades. Upgrades will still be allowed.",
new EnvironmentKnobSource("AZP_AGENT_DOWNGRADE_DISABLED"),
new BuiltInDefaultKnobSource("false"));

public static readonly Knob AcknowledgeNoUpdates = new Knob(
nameof(AcknowledgeNoUpdates),
"Opt-in to continue using agent without updates on unsopperted OS",
new EnvironmentKnobSource("AGENT_ACKNOWLEDGE_NO_UPDATES"),
new RuntimeKnobSource("AGENT_ACKNOWLEDGE_NO_UPDATES"),
new BuiltInDefaultKnobSource("false"));

public static readonly Knob PermissionsCheckFailsafe = new Knob(
nameof(PermissionsCheckFailsafe),
Expand Down
10 changes: 9 additions & 1 deletion src/Agent.Worker/JobRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,21 @@ public async Task<TaskResult> RunAsync(Pipelines.AgentJobRequestMessage message,
}

if (!string.IsNullOrWhiteSpace(notSupportNet6Message))
{
{
if(!AgentKnobs.AcknowledgeNoUpdates.GetValue(jobContext).AsBoolean())
{
jobContext.Error(StringUtil.Loc("FailAgentOnUnsupportedOs"));
return await CompleteJobAsync(jobServer, jobContext, message, TaskResult.Failed);
}

jobContext.AddIssue(new Issue() { Type = IssueType.Warning, Message = notSupportNet6Message });
}
}
catch (Exception ex)
{
Trace.Error($"Error has occurred while checking if system supports .NET 6: {ex}");
return await CompleteJobAsync(jobServer, jobContext, message, TaskResult.Failed);

}
}

Expand Down
1 change: 1 addition & 0 deletions src/Misc/layoutbin/en-US/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@
"ExpectedMappingLocalPath": "Expected mapping[{0}] local path: '{1}'. Actual: '{2}'",
"ExpectedMappingRecursive": "Expected mapping[{0}] recursive: '{1}'. Actual: '{2}'",
"ExpectedMappingServerPath": "Expected mapping[{0}] server path: '{1}'. Actual: '{2}'",
"FailAgentOnUnsupportedOs": "This operating system will stop receiving updates of the Pipelines Agent in the future. To be able to continue to run pipelines please upgrade the operating system or set an environment variable or agent knob \"AGENT_ACKNOWLEDGE_NO_UPDATES\" to \"true\". See https://aka.ms/azdo-pipeline-agent-nosupport for more information.",
"Failed": "Failed: ",
"FailedDeletingTempDirectory0Message1": "Failed to delete temporary directory '{0}'. {1}",
"FailedTestsInResults": "There are one or more test failures detected in result files. Detailed summary of published test results can be viewed in the Tests tab.",
Expand Down