mirror of
https://github.com/actions/runner.git
synced 2025-12-11 04:46:58 +00:00
Show more information in the runner log (#2377)
* fix typo * add workflow ref in the log * show job name for all jobs * update ref * reflect the feedback * fix a small bug
This commit is contained in:
@@ -35,7 +35,7 @@ All the configs below can be found in `.vscode/launch.json`.
|
|||||||
If you launch `Run` or `Run [build]`, it starts a process called `Runner.Listener`.
|
If you launch `Run` or `Run [build]`, it starts a process called `Runner.Listener`.
|
||||||
This process will receive any job queued on this repository if the job runs on matching labels (e.g `runs-on: self-hosted`).
|
This process will receive any job queued on this repository if the job runs on matching labels (e.g `runs-on: self-hosted`).
|
||||||
Once a job is received, a `Runner.Listener` starts a new process of `Runner.Worker`.
|
Once a job is received, a `Runner.Listener` starts a new process of `Runner.Worker`.
|
||||||
Since this is a diferent process, you can't use the same debugger session debug it.
|
Since this is a different process, you can't use the same debugger session debug it.
|
||||||
Instead, a parallel debugging session has to be started, using a different launch config.
|
Instead, a parallel debugging session has to be started, using a different launch config.
|
||||||
Luckily, VS Code supports multiple parallel debugging sessions.
|
Luckily, VS Code supports multiple parallel debugging sessions.
|
||||||
|
|
||||||
|
|||||||
@@ -321,7 +321,10 @@ namespace GitHub.Runner.Worker
|
|||||||
|
|
||||||
if (message.Variables.TryGetValue("system.workflowFileFullPath", out VariableValue workflowFileFullPath))
|
if (message.Variables.TryGetValue("system.workflowFileFullPath", out VariableValue workflowFileFullPath))
|
||||||
{
|
{
|
||||||
context.Output($"Uses: {workflowFileFullPath.Value}");
|
var usesLogText = $"Uses: {workflowFileFullPath.Value}";
|
||||||
|
var reference = GetWorkflowReference(message.Variables);
|
||||||
|
context.Output(usesLogText + reference);
|
||||||
|
|
||||||
if (message.ContextData.TryGetValue("inputs", out var pipelineContextData))
|
if (message.ContextData.TryGetValue("inputs", out var pipelineContextData))
|
||||||
{
|
{
|
||||||
var inputs = pipelineContextData.AssertDictionary("inputs");
|
var inputs = pipelineContextData.AssertDictionary("inputs");
|
||||||
@@ -335,12 +338,12 @@ namespace GitHub.Runner.Worker
|
|||||||
context.Output("##[endgroup]");
|
context.Output("##[endgroup]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(message.JobDisplayName))
|
if (!string.IsNullOrWhiteSpace(message.JobDisplayName))
|
||||||
{
|
{
|
||||||
context.Output($"Complete job name: {message.JobDisplayName}");
|
context.Output($"Complete job name: {message.JobDisplayName}");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var intraActionStates = new Dictionary<Guid, Dictionary<string, string>>();
|
var intraActionStates = new Dictionary<Guid, Dictionary<string, string>>();
|
||||||
foreach (var preStep in prepareResult.PreStepTracker)
|
foreach (var preStep in prepareResult.PreStepTracker)
|
||||||
@@ -452,6 +455,24 @@ namespace GitHub.Runner.Worker
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string GetWorkflowReference(IDictionary<string, VariableValue> variables)
|
||||||
|
{
|
||||||
|
var reference = "";
|
||||||
|
if (variables.TryGetValue("system.workflowFileSha", out VariableValue workflowFileSha))
|
||||||
|
{
|
||||||
|
if (variables.TryGetValue("system.workflowFileRef", out VariableValue workflowFileRef)
|
||||||
|
&& !string.IsNullOrEmpty(workflowFileRef.Value))
|
||||||
|
{
|
||||||
|
reference += $"@{workflowFileRef.Value} ({workflowFileSha.Value})";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
reference += $"@{workflowFileSha.Value}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return reference;
|
||||||
|
}
|
||||||
|
|
||||||
public void FinalizeJob(IExecutionContext jobContext, Pipelines.AgentJobRequestMessage message, DateTime jobStartTimeUtc)
|
public void FinalizeJob(IExecutionContext jobContext, Pipelines.AgentJobRequestMessage message, DateTime jobStartTimeUtc)
|
||||||
{
|
{
|
||||||
Trace.Entering();
|
Trace.Entering();
|
||||||
|
|||||||
Reference in New Issue
Block a user