Skip to content

Commit

Permalink
Revert "Allow running agent in debugging mode for specific node task (#…
Browse files Browse the repository at this point in the history
…4838)" (#4898)

This reverts commit 3f88445.
  • Loading branch information
kirill-ivlev authored Jul 18, 2024
1 parent 745922b commit c660a56
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 40 deletions.
7 changes: 0 additions & 7 deletions src/Agent.Listener/Agent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,13 +216,6 @@ public async Task<int> ExecuteCommand(CommandSettings command)
Trace.Info($"Set agent startup type - {startType}");
HostContext.StartupType = startType;

bool debugModeEnabled = command.GetDebugMode();
settings.DebugMode = debugModeEnabled;
store.SaveSettings(settings);
if (debugModeEnabled)
{
Trace.Warning("Agent is running in debug mode, don't use it in production");
}
if (PlatformUtil.RunningOnWindows)
{
if (store.IsAutoLogonConfigured())
Expand Down
3 changes: 0 additions & 3 deletions src/Agent.Listener/CommandLine/RunAgent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,5 @@ public class RunAgent : BaseCommand

[Option(Constants.Agent.CommandLine.Args.StartupType)]
public string StartupType { get; set; }

[Option(Constants.Agent.CommandLine.Flags.DebugMode)]
public bool DebugMode { get; set; }
}
}
5 changes: 0 additions & 5 deletions src/Agent.Listener/CommandSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -550,11 +550,6 @@ public bool GetRunOnce()
TestFlag(Run?.RunOnce, Constants.Agent.CommandLine.Flags.Once);
}

public bool GetDebugMode()
{
return TestFlag(Run?.DebugMode, Constants.Agent.CommandLine.Flags.DebugMode);
}

public bool GetDeploymentPool()
{
return TestFlag(Configure?.DeploymentPool, Constants.Agent.CommandLine.Flags.DeploymentPool);
Expand Down
6 changes: 0 additions & 6 deletions src/Agent.Sdk/Knob/AgentKnobs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,6 @@ public class AgentKnobs
new EnvironmentKnobSource("VSTSAGENT_TRACE"),
new BuiltInDefaultKnobSource(string.Empty));

public static readonly Knob DebugTask = new Knob(
nameof(DebugTask),
"If the agent executes a task which ID or name matches the value provided, it will run the task so that it will wait for debugger to attach",
new EnvironmentKnobSource("VSTSAGENT_DEBUG_TASK"),
new BuiltInDefaultKnobSource(string.Empty));

public static readonly Knob DumpJobEventLogs = new Knob(
nameof(DumpJobEventLogs),
"If true, dump event viewer logs",
Expand Down
15 changes: 0 additions & 15 deletions src/Agent.Worker/Handlers/NodeHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -224,21 +224,6 @@ public async Task RunAsync()
var sigtermTimeout = TimeSpan.FromMilliseconds(AgentKnobs.ProccessSigtermTimeout.GetValue(ExecutionContext).AsInt());
var useGracefulShutdown = AgentKnobs.UseGracefulProcessShutdown.GetValue(ExecutionContext).AsBoolean();

var configStore = HostContext.GetService<IConfigurationStore>();
var agentSettings = configStore.GetSettings();
if (agentSettings.DebugMode)
{
var debugTask = AgentKnobs.DebugTask.GetValue(ExecutionContext).AsString();
if (!string.IsNullOrEmpty(debugTask))
{
if (string.Equals(Task?.Id.ToString("D"), debugTask, StringComparison.OrdinalIgnoreCase) || string.Equals(Task?.Name, debugTask, StringComparison.OrdinalIgnoreCase))
{
arguments = $"--inspect-brk {arguments}";
}
}
}


try
{
// Execute the process. Exit code 0 should always be returned.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,6 @@ public string Fingerprint

[DataMember(EmitDefaultValue = false)]
public int MaxDedupParallelism { get; set; }

[DataMember(EmitDefaultValue = false)]
public bool DebugMode { get; set; }
}

[DataContract]
Expand Down
1 change: 0 additions & 1 deletion src/Microsoft.VisualStudio.Services.Agent/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ public static class Flags
public const string NoRestart = "norestart";
public const string LaunchBrowser = "launchbrowser";
public const string Once = "once";
public const string DebugMode = "debug";
public const string RunAsAutoLogon = "runasautologon";
public const string RunAsService = "runasservice";
public const string PreventServiceStart = "preventservicestart";
Expand Down

0 comments on commit c660a56

Please sign in to comment.