mirror of
https://github.com/actions/runner.git
synced 2026-01-23 04:51:23 +08:00
Phase 3 complete
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
- [x] **Phase 1:** DAP Protocol Infrastructure (DapMessages.cs, DapServer.cs, basic DapDebugSession.cs)
|
- [x] **Phase 1:** DAP Protocol Infrastructure (DapMessages.cs, DapServer.cs, basic DapDebugSession.cs)
|
||||||
- [x] **Phase 2:** Debug Session Logic (DapVariableProvider.cs, variable inspection, step history tracking)
|
- [x] **Phase 2:** Debug Session Logic (DapVariableProvider.cs, variable inspection, step history tracking)
|
||||||
- [ ] **Phase 3:** StepsRunner Integration (pause hooks before/after step execution)
|
- [x] **Phase 3:** StepsRunner Integration (pause hooks before/after step execution)
|
||||||
- [ ] **Phase 4:** Expression Evaluation & Shell (REPL)
|
- [ ] **Phase 4:** Expression Evaluation & Shell (REPL)
|
||||||
- [ ] **Phase 5:** Startup Integration (JobRunner.cs modifications)
|
- [ ] **Phase 5:** Startup Integration (JobRunner.cs modifications)
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -10,6 +10,7 @@ using GitHub.DistributedTask.WebApi;
|
|||||||
using GitHub.Runner.Common;
|
using GitHub.Runner.Common;
|
||||||
using GitHub.Runner.Common.Util;
|
using GitHub.Runner.Common.Util;
|
||||||
using GitHub.Runner.Sdk;
|
using GitHub.Runner.Sdk;
|
||||||
|
using GitHub.Runner.Worker.Dap;
|
||||||
using GitHub.Runner.Worker.Expressions;
|
using GitHub.Runner.Worker.Expressions;
|
||||||
|
|
||||||
namespace GitHub.Runner.Worker
|
namespace GitHub.Runner.Worker
|
||||||
@@ -50,6 +51,12 @@ namespace GitHub.Runner.Worker
|
|||||||
jobContext.JobContext.Status = (jobContext.Result ?? TaskResult.Succeeded).ToActionResult();
|
jobContext.JobContext.Status = (jobContext.Result ?? TaskResult.Succeeded).ToActionResult();
|
||||||
var scopeInputs = new Dictionary<string, PipelineContextData>(StringComparer.OrdinalIgnoreCase);
|
var scopeInputs = new Dictionary<string, PipelineContextData>(StringComparer.OrdinalIgnoreCase);
|
||||||
bool checkPostJobActions = false;
|
bool checkPostJobActions = false;
|
||||||
|
|
||||||
|
// Get debug session for DAP debugging support
|
||||||
|
// The session's IsActive property determines if debugging is actually enabled
|
||||||
|
var debugSession = HostContext.GetService<IDapDebugSession>();
|
||||||
|
bool isFirstStep = true;
|
||||||
|
|
||||||
while (jobContext.JobSteps.Count > 0 || !checkPostJobActions)
|
while (jobContext.JobSteps.Count > 0 || !checkPostJobActions)
|
||||||
{
|
{
|
||||||
if (jobContext.JobSteps.Count == 0 && !checkPostJobActions)
|
if (jobContext.JobSteps.Count == 0 && !checkPostJobActions)
|
||||||
@@ -181,6 +188,14 @@ namespace GitHub.Runner.Worker
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Pause for DAP debugger BEFORE step execution
|
||||||
|
// This happens after expression values are set up so the debugger can inspect variables
|
||||||
|
if (debugSession?.IsActive == true)
|
||||||
|
{
|
||||||
|
await debugSession.OnStepStartingAsync(step, jobContext, isFirstStep);
|
||||||
|
isFirstStep = false;
|
||||||
|
}
|
||||||
|
|
||||||
// Evaluate condition
|
// Evaluate condition
|
||||||
step.ExecutionContext.Debug($"Evaluating condition for step: '{step.DisplayName}'");
|
step.ExecutionContext.Debug($"Evaluating condition for step: '{step.DisplayName}'");
|
||||||
var conditionTraceWriter = new ConditionTraceWriter(Trace, step.ExecutionContext);
|
var conditionTraceWriter = new ConditionTraceWriter(Trace, step.ExecutionContext);
|
||||||
@@ -253,8 +268,17 @@ namespace GitHub.Runner.Worker
|
|||||||
Trace.Info($"No need for updating job result with current step result '{step.ExecutionContext.Result}'.");
|
Trace.Info($"No need for updating job result with current step result '{step.ExecutionContext.Result}'.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Notify DAP debugger AFTER step execution
|
||||||
|
if (debugSession?.IsActive == true)
|
||||||
|
{
|
||||||
|
debugSession.OnStepCompleted(step);
|
||||||
|
}
|
||||||
|
|
||||||
Trace.Info($"Current state: job state = '{jobContext.Result}'");
|
Trace.Info($"Current state: job state = '{jobContext.Result}'");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Notify DAP debugger that the job has completed
|
||||||
|
debugSession?.OnJobCompleted();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task RunStepAsync(IStep step, CancellationToken jobCancellationToken)
|
private async Task RunStepAsync(IStep step, CancellationToken jobCancellationToken)
|
||||||
|
|||||||
Reference in New Issue
Block a user