Skip to content

Commit cd8e4dd

Browse files
authored
Validate inputs only for repo action, no warning for small delay. (#476)
* validate inputs only for repo action, no warning for small delay. * l0
1 parent abf59bd commit cd8e4dd

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

src/Runner.Worker/ActionRunner.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,15 @@ Action.Reference is Pipelines.RepositoryPathReference repoAction &&
170170
}
171171
}
172172

173-
foreach (var input in userInputs)
173+
// Validate inputs only for actions with action.yml
174+
if (Action.Reference.Type == Pipelines.ActionSourceType.Repository)
174175
{
175-
if (!validInputs.Contains(input))
176+
foreach (var input in userInputs)
176177
{
177-
ExecutionContext.Warning($"Unexpected input '{input}', valid inputs are ['{string.Join("', '", validInputs)}']");
178+
if (!validInputs.Contains(input))
179+
{
180+
ExecutionContext.Warning($"Unexpected input '{input}', valid inputs are ['{string.Join("', '", validInputs)}']");
181+
}
178182
}
179183
}
180184

src/Runner.Worker/ExecutionContext.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ public interface IExecutionContext : IRunnerService
109109
public sealed class ExecutionContext : RunnerService, IExecutionContext
110110
{
111111
private const int _maxIssueCount = 10;
112+
private const int _throttlingDelayReportThreshold = 10 * 1000; // Don't report throttling with less than 10 seconds delay
112113

113114
private readonly TimelineRecord _record = new TimelineRecord();
114115
private readonly Dictionary<Guid, TimelineRecord> _detailRecords = new Dictionary<Guid, TimelineRecord>();
@@ -335,7 +336,7 @@ public TaskResult Complete(TaskResult? result = null, string currentOperation =
335336
}
336337

337338
// report total delay caused by server throttling.
338-
if (_totalThrottlingDelayInMilliseconds > 0)
339+
if (_totalThrottlingDelayInMilliseconds > _throttlingDelayReportThreshold)
339340
{
340341
this.Warning($"The job has experienced {TimeSpan.FromMilliseconds(_totalThrottlingDelayInMilliseconds).TotalSeconds} seconds total delay caused by server throttling.");
341342
}
@@ -851,7 +852,8 @@ private void JobServerQueueThrottling_EventReceived(object sender, ThrottlingEve
851852
{
852853
Interlocked.Add(ref _totalThrottlingDelayInMilliseconds, Convert.ToInt64(data.Delay.TotalMilliseconds));
853854

854-
if (!_throttlingReported)
855+
if (!_throttlingReported &&
856+
_totalThrottlingDelayInMilliseconds > _throttlingDelayReportThreshold)
855857
{
856858
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."));
857859

src/Test/L0/Worker/ActionRunnerL0.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,9 +295,10 @@ public async void WarnInvalidInputs()
295295
{
296296
Name = "action",
297297
Id = actionId,
298-
Reference = new Pipelines.ContainerRegistryReference()
298+
Reference = new Pipelines.RepositoryPathReference()
299299
{
300-
Image = "ubuntu:16.04"
300+
Name = "actions/runner",
301+
Ref = "v1"
301302
},
302303
Inputs = actionInputs
303304
};

0 commit comments

Comments
 (0)