Validate inputs only for repo action, no warning for small delay. (#476)

* validate inputs only for repo action, no warning for small delay.

* l0
This commit is contained in:
Tingluo Huang
2020-05-12 16:09:13 -04:00
committed by GitHub
parent abf59bdcb6
commit cd8e4ddba1
3 changed files with 14 additions and 7 deletions

View File

@@ -170,11 +170,15 @@ namespace GitHub.Runner.Worker
}
}
foreach (var input in userInputs)
// Validate inputs only for actions with action.yml
if (Action.Reference.Type == Pipelines.ActionSourceType.Repository)
{
if (!validInputs.Contains(input))
foreach (var input in userInputs)
{
ExecutionContext.Warning($"Unexpected input '{input}', valid inputs are ['{string.Join("', '", validInputs)}']");
if (!validInputs.Contains(input))
{
ExecutionContext.Warning($"Unexpected input '{input}', valid inputs are ['{string.Join("', '", validInputs)}']");
}
}
}

View File

@@ -109,6 +109,7 @@ namespace GitHub.Runner.Worker
public sealed class ExecutionContext : RunnerService, IExecutionContext
{
private const int _maxIssueCount = 10;
private const int _throttlingDelayReportThreshold = 10 * 1000; // Don't report throttling with less than 10 seconds delay
private readonly TimelineRecord _record = new TimelineRecord();
private readonly Dictionary<Guid, TimelineRecord> _detailRecords = new Dictionary<Guid, TimelineRecord>();
@@ -335,7 +336,7 @@ namespace GitHub.Runner.Worker
}
// report total delay caused by server throttling.
if (_totalThrottlingDelayInMilliseconds > 0)
if (_totalThrottlingDelayInMilliseconds > _throttlingDelayReportThreshold)
{
this.Warning($"The job has experienced {TimeSpan.FromMilliseconds(_totalThrottlingDelayInMilliseconds).TotalSeconds} seconds total delay caused by server throttling.");
}
@@ -851,7 +852,8 @@ namespace GitHub.Runner.Worker
{
Interlocked.Add(ref _totalThrottlingDelayInMilliseconds, Convert.ToInt64(data.Delay.TotalMilliseconds));
if (!_throttlingReported)
if (!_throttlingReported &&
_totalThrottlingDelayInMilliseconds > _throttlingDelayReportThreshold)
{
this.Warning(string.Format("The job is currently being throttled by the server. You may experience delays in console line output, job status reporting, and action log uploads."));

View File

@@ -295,9 +295,10 @@ namespace GitHub.Runner.Common.Tests.Worker
{
Name = "action",
Id = actionId,
Reference = new Pipelines.ContainerRegistryReference()
Reference = new Pipelines.RepositoryPathReference()
{
Image = "ubuntu:16.04"
Name = "actions/runner",
Ref = "v1"
},
Inputs = actionInputs
};