mirror of
https://github.com/actions/runner.git
synced 2026-03-28 18:27:13 +08:00
Added a setter to GitHub.DistributedTask.WebApi.Issue's key-value-pair indexer.
This commit is contained in:
@@ -299,7 +299,7 @@ namespace GitHub.Runner.Common
|
||||
{
|
||||
try
|
||||
{
|
||||
// Give at most 60s for each request.
|
||||
// Give at most 60s for each request.
|
||||
using (var timeoutTokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(60)))
|
||||
{
|
||||
await _jobServer.AppendTimelineRecordFeedAsync(_scopeIdentifier, _hubName, _planId, _jobTimelineId, _jobTimelineRecordId, stepRecordId, batch.Select(logLine => logLine.Line).ToList(), batch[0].LineNumber, timeoutTokenSource.Token);
|
||||
@@ -600,8 +600,7 @@ namespace GitHub.Runner.Common
|
||||
{
|
||||
foreach (var issue in record.Issues)
|
||||
{
|
||||
String source;
|
||||
issue.Data.TryGetValue("sourcepath", out source);
|
||||
string source = issue["sourcepath"];
|
||||
Trace.Verbose($" Issue: c={issue.Category}, t={issue.Type}, s={source ?? string.Empty}, m={issue.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace GitHub.Runner.Listener
|
||||
// This implementation of IJobDispatcher is not thread safe.
|
||||
// It is based on the fact that the current design of the runner is a dequeue
|
||||
// and processes one message from the message queue at a time.
|
||||
// In addition, it only executes one job every time,
|
||||
// In addition, it only executes one job every time,
|
||||
// and the server will not send another job while this one is still running.
|
||||
public sealed class JobDispatcher : RunnerService, IJobDispatcher
|
||||
{
|
||||
@@ -426,7 +426,7 @@ namespace GitHub.Runner.Listener
|
||||
{
|
||||
workerOutput.Add(stdout.Data);
|
||||
}
|
||||
|
||||
|
||||
if (printToStdout)
|
||||
{
|
||||
term.WriteLine(stdout.Data, skipTracing: true);
|
||||
@@ -512,7 +512,7 @@ namespace GitHub.Runner.Listener
|
||||
var accessToken = systemConnection?.Authorization?.Parameters["AccessToken"];
|
||||
notification.JobStarted(message.JobId, accessToken, systemConnection.Url);
|
||||
|
||||
HostContext.WritePerfCounter($"SentJobToWorker_{requestId.ToString()}");
|
||||
HostContext.WritePerfCounter($"SentJobToWorker_{requestId}");
|
||||
|
||||
try
|
||||
{
|
||||
@@ -620,7 +620,7 @@ namespace GitHub.Runner.Listener
|
||||
}
|
||||
}
|
||||
|
||||
// wait worker to exit
|
||||
// wait worker to exit
|
||||
// if worker doesn't exit within timeout, then kill worker.
|
||||
completedTask = await Task.WhenAny(workerProcessTask, Task.Delay(-1, workerCancelTimeoutKillToken));
|
||||
|
||||
@@ -1014,7 +1014,7 @@ namespace GitHub.Runner.Listener
|
||||
}
|
||||
|
||||
var unhandledExceptionIssue = new Issue() { Type = IssueType.Error, Message = errorMessage };
|
||||
unhandledExceptionIssue.Data[Constants.Runner.InternalTelemetryIssueDataKey] = Constants.Runner.WorkerCrash;
|
||||
unhandledExceptionIssue[Constants.Runner.InternalTelemetryIssueDataKey] = Constants.Runner.WorkerCrash;
|
||||
jobRecord.ErrorCount++;
|
||||
jobRecord.Issues.Add(unhandledExceptionIssue);
|
||||
await jobServer.UpdateTimelineRecordsAsync(message.Plan.ScopeIdentifier, message.Plan.PlanType, message.Plan.PlanId, message.Timeline.Id, new TimelineRecord[] { jobRecord }, CancellationToken.None);
|
||||
|
||||
@@ -591,13 +591,20 @@ namespace GitHub.Runner.Worker
|
||||
Message = refinedMessage,
|
||||
};
|
||||
|
||||
result.Data.AddRangeIfRangeNotNull(metadata?.Data);
|
||||
|
||||
if (metadata != null)
|
||||
{
|
||||
foreach (var kvp in metadata.Data)
|
||||
{
|
||||
result[kvp.Key] = kvp.Value;
|
||||
}
|
||||
}
|
||||
|
||||
// It's important to keep track of the step number (key:stepNumber) and the line number (key:logFileLineNumber) of every issue that gets logged.
|
||||
// Actions UI from the run summary page use both values to easily link to an exact locations in logs where annotations originate from.
|
||||
if (_record.Order != null)
|
||||
{
|
||||
result.Data["stepNumber"] = _record.Order.ToString();
|
||||
result["stepNumber"] = _record.Order.ToString();
|
||||
}
|
||||
|
||||
string wellKnownTag = null;
|
||||
@@ -627,7 +634,7 @@ namespace GitHub.Runner.Worker
|
||||
if (!string.IsNullOrEmpty(logText))
|
||||
{
|
||||
long logLineNumber = Write(wellKnownTag, logText);
|
||||
result.Data["logFileLineNumber"] = logLineNumber.ToString();
|
||||
result["logFileLineNumber"] = logLineNumber.ToString();
|
||||
}
|
||||
}
|
||||
if (previousCountForIssueType.GetValueOrDefault(0) < _maxIssueCount)
|
||||
|
||||
@@ -5,7 +5,6 @@ using GitHub.Services.Common;
|
||||
|
||||
namespace GitHub.DistributedTask.WebApi
|
||||
{
|
||||
|
||||
public interface IReadOnlyIssue
|
||||
{
|
||||
IssueType Type { get; }
|
||||
@@ -26,14 +25,14 @@ namespace GitHub.DistributedTask.WebApi
|
||||
|
||||
private Issue(Issue original)
|
||||
{
|
||||
m_data = new Dictionary<String, String>(StringComparer.OrdinalIgnoreCase);
|
||||
m_data = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
if (original != null)
|
||||
{
|
||||
this.Type = original.Type;
|
||||
this.Category = original.Category;
|
||||
this.Message = original.Message;
|
||||
this.IsInfrastructureIssue = original.IsInfrastructureIssue;
|
||||
this.Data.AddRange(original.Data);
|
||||
m_data.AddRange(original.m_data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,14 +44,14 @@ namespace GitHub.DistributedTask.WebApi
|
||||
}
|
||||
|
||||
[DataMember(Order = 2)]
|
||||
public String Category
|
||||
public string Category
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
[DataMember(Order = 3)]
|
||||
public String Message
|
||||
public string Message
|
||||
{
|
||||
get;
|
||||
set;
|
||||
@@ -65,14 +64,6 @@ namespace GitHub.DistributedTask.WebApi
|
||||
set;
|
||||
}
|
||||
|
||||
public IDictionary<String, String> Data
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_data;
|
||||
}
|
||||
}
|
||||
|
||||
public string this[string key]
|
||||
{
|
||||
get
|
||||
@@ -80,9 +71,12 @@ namespace GitHub.DistributedTask.WebApi
|
||||
m_data.TryGetValue(key, out string result);
|
||||
return result;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_data[key] = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Issue Clone()
|
||||
{
|
||||
return new Issue(this);
|
||||
@@ -107,8 +101,8 @@ namespace GitHub.DistributedTask.WebApi
|
||||
}
|
||||
|
||||
[DataMember(Name = "Data", EmitDefaultValue = false, Order = 4)]
|
||||
private IDictionary<String, String> m_serializedData;
|
||||
private IDictionary<string, string> m_serializedData;
|
||||
|
||||
private IDictionary<String, String> m_data;
|
||||
private IDictionary<string, string> m_data;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user