mirror of
https://github.com/actions/runner.git
synced 2025-12-11 04:46:58 +00:00
Compare commits
1 Commits
v2.306.0
...
users/eric
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
523d7f9454 |
@@ -64,6 +64,8 @@ namespace GitHub.Runner.Worker
|
|||||||
|
|
||||||
public Pipelines.ActionStep Action { get; set; }
|
public Pipelines.ActionStep Action { get; set; }
|
||||||
|
|
||||||
|
public Int32 Retries => Action?.Retries ?? 0;
|
||||||
|
|
||||||
public TemplateToken Timeout => Action?.TimeoutInMinutes;
|
public TemplateToken Timeout => Action?.TimeoutInMinutes;
|
||||||
|
|
||||||
public async Task RunAsync()
|
public async Task RunAsync()
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ namespace GitHub.Runner.Worker
|
|||||||
public TemplateToken ContinueOnError => new BooleanToken(null, null, null, false);
|
public TemplateToken ContinueOnError => new BooleanToken(null, null, null, false);
|
||||||
public string DisplayName { get; set; }
|
public string DisplayName { get; set; }
|
||||||
public IExecutionContext ExecutionContext { get; set; }
|
public IExecutionContext ExecutionContext { get; set; }
|
||||||
|
public Int32 Retries => 0;
|
||||||
public TemplateToken Timeout => new NumberToken(null, null, null, 0);
|
public TemplateToken Timeout => new NumberToken(null, null, null, 0);
|
||||||
public object Data => _data;
|
public object Data => _data;
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ namespace GitHub.Runner.Worker
|
|||||||
TemplateToken ContinueOnError { get; }
|
TemplateToken ContinueOnError { get; }
|
||||||
string DisplayName { get; set; }
|
string DisplayName { get; set; }
|
||||||
IExecutionContext ExecutionContext { get; set; }
|
IExecutionContext ExecutionContext { get; set; }
|
||||||
|
Int32 Retries { get; }
|
||||||
TemplateToken Timeout { get; }
|
TemplateToken Timeout { get; }
|
||||||
Task RunAsync();
|
Task RunAsync();
|
||||||
}
|
}
|
||||||
@@ -280,6 +281,10 @@ namespace GitHub.Runner.Worker
|
|||||||
step.ExecutionContext.Error("An error occurred when attempting to determine the step timeout.");
|
step.ExecutionContext.Error("An error occurred when attempting to determine the step timeout.");
|
||||||
step.ExecutionContext.Error(ex);
|
step.ExecutionContext.Error(ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int attempt = 1;
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
if (timeoutMinutes > 0)
|
if (timeoutMinutes > 0)
|
||||||
{
|
{
|
||||||
var timeout = TimeSpan.FromMinutes(timeoutMinutes);
|
var timeout = TimeSpan.FromMinutes(timeoutMinutes);
|
||||||
@@ -348,6 +353,25 @@ namespace GitHub.Runner.Worker
|
|||||||
}
|
}
|
||||||
Trace.Info($"Step result: {step.ExecutionContext.Result}");
|
Trace.Info($"Step result: {step.ExecutionContext.Result}");
|
||||||
|
|
||||||
|
if (step.ExecutionContext.Result == TaskResult.Failed && attempt <= step.Retries)
|
||||||
|
{
|
||||||
|
attempt++;
|
||||||
|
step.ExecutionContext.Result = null;
|
||||||
|
step.ExecutionContext.ResultCode = null;
|
||||||
|
// todo: replace the step cancellation token source
|
||||||
|
// todo: reset the step.ExecutionContext.CommandResult
|
||||||
|
// todo: create a new timeline record, e.g. "My display name (#2)"
|
||||||
|
// todo: clear outputs? What will we do on a job? probably clear outputs since merging from separate timeline attempts would otherwise be complex
|
||||||
|
// todo: consider intrastate - i guess it makes sense this doesn't get cleared
|
||||||
|
// todo: reconcile all of the above wrt composite steps
|
||||||
|
// todo: reconcile all of the above wrt pre/post
|
||||||
|
// todo: distinguish retryable vs non-retryable failures? e.g. if an exception bubbles from the handler
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// Complete the step context.
|
// Complete the step context.
|
||||||
step.ExecutionContext.Debug($"Finishing: {step.DisplayName}");
|
step.ExecutionContext.Debug($"Finishing: {step.DisplayName}");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ namespace GitHub.DistributedTask.Pipelines
|
|||||||
this.Reference = actionToClone.Reference?.Clone();
|
this.Reference = actionToClone.Reference?.Clone();
|
||||||
|
|
||||||
Environment = actionToClone.Environment?.Clone();
|
Environment = actionToClone.Environment?.Clone();
|
||||||
|
Retries = actionToClone.Retries;
|
||||||
Inputs = actionToClone.Inputs?.Clone();
|
Inputs = actionToClone.Inputs?.Clone();
|
||||||
ContextName = actionToClone?.ContextName;
|
ContextName = actionToClone?.ContextName;
|
||||||
DisplayNameToken = actionToClone.DisplayNameToken?.Clone();
|
DisplayNameToken = actionToClone.DisplayNameToken?.Clone();
|
||||||
@@ -46,6 +47,9 @@ namespace GitHub.DistributedTask.Pipelines
|
|||||||
[DataMember(EmitDefaultValue = false)]
|
[DataMember(EmitDefaultValue = false)]
|
||||||
public TemplateToken Environment { get; set; }
|
public TemplateToken Environment { get; set; }
|
||||||
|
|
||||||
|
[DataMember(EmitDefaultValue = false)]
|
||||||
|
public Int32 Retries { get; set; }
|
||||||
|
|
||||||
[DataMember(EmitDefaultValue = false)]
|
[DataMember(EmitDefaultValue = false)]
|
||||||
public TemplateToken Inputs { get; set; }
|
public TemplateToken Inputs { get; set; }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user