Skip to content

Commit c660a56

Browse files
authored
Revert "Allow running agent in debugging mode for specific node task (#4838)" (#4898)
This reverts commit 3f88445.
1 parent 745922b commit c660a56

File tree

7 files changed

+0
-40
lines changed

7 files changed

+0
-40
lines changed

src/Agent.Listener/Agent.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -216,13 +216,6 @@ public async Task<int> ExecuteCommand(CommandSettings command)
216216
Trace.Info($"Set agent startup type - {startType}");
217217
HostContext.StartupType = startType;
218218

219-
bool debugModeEnabled = command.GetDebugMode();
220-
settings.DebugMode = debugModeEnabled;
221-
store.SaveSettings(settings);
222-
if (debugModeEnabled)
223-
{
224-
Trace.Warning("Agent is running in debug mode, don't use it in production");
225-
}
226219
if (PlatformUtil.RunningOnWindows)
227220
{
228221
if (store.IsAutoLogonConfigured())

src/Agent.Listener/CommandLine/RunAgent.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,5 @@ public class RunAgent : BaseCommand
1818

1919
[Option(Constants.Agent.CommandLine.Args.StartupType)]
2020
public string StartupType { get; set; }
21-
22-
[Option(Constants.Agent.CommandLine.Flags.DebugMode)]
23-
public bool DebugMode { get; set; }
2421
}
2522
}

src/Agent.Listener/CommandSettings.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -550,11 +550,6 @@ public bool GetRunOnce()
550550
TestFlag(Run?.RunOnce, Constants.Agent.CommandLine.Flags.Once);
551551
}
552552

553-
public bool GetDebugMode()
554-
{
555-
return TestFlag(Run?.DebugMode, Constants.Agent.CommandLine.Flags.DebugMode);
556-
}
557-
558553
public bool GetDeploymentPool()
559554
{
560555
return TestFlag(Configure?.DeploymentPool, Constants.Agent.CommandLine.Flags.DeploymentPool);

src/Agent.Sdk/Knob/AgentKnobs.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -213,12 +213,6 @@ public class AgentKnobs
213213
new EnvironmentKnobSource("VSTSAGENT_TRACE"),
214214
new BuiltInDefaultKnobSource(string.Empty));
215215

216-
public static readonly Knob DebugTask = new Knob(
217-
nameof(DebugTask),
218-
"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",
219-
new EnvironmentKnobSource("VSTSAGENT_DEBUG_TASK"),
220-
new BuiltInDefaultKnobSource(string.Empty));
221-
222216
public static readonly Knob DumpJobEventLogs = new Knob(
223217
nameof(DumpJobEventLogs),
224218
"If true, dump event viewer logs",

src/Agent.Worker/Handlers/NodeHandler.cs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -224,21 +224,6 @@ public async Task RunAsync()
224224
var sigtermTimeout = TimeSpan.FromMilliseconds(AgentKnobs.ProccessSigtermTimeout.GetValue(ExecutionContext).AsInt());
225225
var useGracefulShutdown = AgentKnobs.UseGracefulProcessShutdown.GetValue(ExecutionContext).AsBoolean();
226226

227-
var configStore = HostContext.GetService<IConfigurationStore>();
228-
var agentSettings = configStore.GetSettings();
229-
if (agentSettings.DebugMode)
230-
{
231-
var debugTask = AgentKnobs.DebugTask.GetValue(ExecutionContext).AsString();
232-
if (!string.IsNullOrEmpty(debugTask))
233-
{
234-
if (string.Equals(Task?.Id.ToString("D"), debugTask, StringComparison.OrdinalIgnoreCase) || string.Equals(Task?.Name, debugTask, StringComparison.OrdinalIgnoreCase))
235-
{
236-
arguments = $"--inspect-brk {arguments}";
237-
}
238-
}
239-
}
240-
241-
242227
try
243228
{
244229
// Execute the process. Exit code 0 should always be returned.

src/Microsoft.VisualStudio.Services.Agent/ConfigurationStore.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,6 @@ public string Fingerprint
132132

133133
[DataMember(EmitDefaultValue = false)]
134134
public int MaxDedupParallelism { get; set; }
135-
136-
[DataMember(EmitDefaultValue = false)]
137-
public bool DebugMode { get; set; }
138135
}
139136

140137
[DataContract]

src/Microsoft.VisualStudio.Services.Agent/Constants.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,6 @@ public static class Flags
225225
public const string NoRestart = "norestart";
226226
public const string LaunchBrowser = "launchbrowser";
227227
public const string Once = "once";
228-
public const string DebugMode = "debug";
229228
public const string RunAsAutoLogon = "runasautologon";
230229
public const string RunAsService = "runasservice";
231230
public const string PreventServiceStart = "preventservicestart";

0 commit comments

Comments
 (0)