mirror of
https://github.com/actions/runner.git
synced 2025-12-11 12:57:05 +00:00
Issue 1261: inconsistency of outputs (both canceled and cancelled are used) (#1624)
* Issue 1261: inconsistency of outputs * Changing cancelled to canceled in one error message
This commit is contained in:
@@ -285,7 +285,7 @@ namespace GitHub.Runner.Listener
|
|||||||
{
|
{
|
||||||
// at this point, the job execution might encounter some dead lock and even not able to be cancelled.
|
// at this point, the job execution might encounter some dead lock and even not able to be cancelled.
|
||||||
// no need to localize the exception string should never happen.
|
// no need to localize the exception string should never happen.
|
||||||
throw new InvalidOperationException($"Job dispatch process for {jobDispatch.JobId} has encountered unexpected error, the dispatch task is not able to be canceled within 45 seconds.");
|
throw new InvalidOperationException($"Job dispatch process for {jobDispatch.JobId} has encountered unexpected error, the dispatch task is not able to be cancelled within 45 seconds.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -363,7 +363,7 @@ namespace GitHub.Runner.Listener
|
|||||||
Trace.Info($"Start renew job request {requestId} for job {message.JobId}.");
|
Trace.Info($"Start renew job request {requestId} for job {message.JobId}.");
|
||||||
Task renewJobRequest = RenewJobRequestAsync(_poolId, requestId, lockToken, orchestrationId, firstJobRequestRenewed, lockRenewalTokenSource.Token);
|
Task renewJobRequest = RenewJobRequestAsync(_poolId, requestId, lockToken, orchestrationId, firstJobRequestRenewed, lockRenewalTokenSource.Token);
|
||||||
|
|
||||||
// wait till first renew succeed or job request is canceled
|
// wait till first renew succeed or job request is cancelled
|
||||||
// not even start worker if the first renew fail
|
// not even start worker if the first renew fail
|
||||||
await Task.WhenAny(firstJobRequestRenewed.Task, renewJobRequest, Task.Delay(-1, jobRequestCancellationToken));
|
await Task.WhenAny(firstJobRequestRenewed.Task, renewJobRequest, Task.Delay(-1, jobRequestCancellationToken));
|
||||||
|
|
||||||
@@ -704,7 +704,7 @@ namespace GitHub.Runner.Listener
|
|||||||
{
|
{
|
||||||
// OperationCanceledException may caused by http timeout or _lockRenewalTokenSource.Cance();
|
// OperationCanceledException may caused by http timeout or _lockRenewalTokenSource.Cance();
|
||||||
// Stop renew only on cancellation token fired.
|
// Stop renew only on cancellation token fired.
|
||||||
Trace.Info($"job renew has been canceled, stop renew job request {requestId}.");
|
Trace.Info($"job renew has been cancelled, stop renew job request {requestId}.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -762,7 +762,7 @@ namespace GitHub.Runner.Listener
|
|||||||
}
|
}
|
||||||
catch (OperationCanceledException) when (token.IsCancellationRequested)
|
catch (OperationCanceledException) when (token.IsCancellationRequested)
|
||||||
{
|
{
|
||||||
Trace.Info($"job renew has been canceled, stop renew job request {requestId}.");
|
Trace.Info($"job renew has been cancelled, stop renew job request {requestId}.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -504,7 +504,7 @@ namespace GitHub.Runner.Listener
|
|||||||
}
|
}
|
||||||
catch (OperationCanceledException) when (token.IsCancellationRequested)
|
catch (OperationCanceledException) when (token.IsCancellationRequested)
|
||||||
{
|
{
|
||||||
Trace.Info($"Runner download has been canceled.");
|
Trace.Info($"Runner download has been cancelled.");
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ namespace GitHub.Runner.Plugins.Repository.v1_0
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// delete the index.lock file left by previous canceled build or any operation cause git.exe crash last time.
|
// delete the index.lock file left by previous cancelled build or any operation cause git.exe crash last time.
|
||||||
string lockFile = Path.Combine(targetPath, ".git\\index.lock");
|
string lockFile = Path.Combine(targetPath, ".git\\index.lock");
|
||||||
if (File.Exists(lockFile))
|
if (File.Exists(lockFile))
|
||||||
{
|
{
|
||||||
@@ -181,7 +181,7 @@ namespace GitHub.Runner.Plugins.Repository.v1_0
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// delete the shallow.lock file left by previous canceled build or any operation cause git.exe crash last time.
|
// delete the shallow.lock file left by previous cancelled build or any operation cause git.exe crash last time.
|
||||||
string shallowLockFile = Path.Combine(targetPath, ".git\\shallow.lock");
|
string shallowLockFile = Path.Combine(targetPath, ".git\\shallow.lock");
|
||||||
if (File.Exists(shallowLockFile))
|
if (File.Exists(shallowLockFile))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ namespace GitHub.Runner.Plugins.Repository.v1_1
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// delete the index.lock file left by previous canceled build or any operation cause git.exe crash last time.
|
// delete the index.lock file left by previous cancelled build or any operation cause git.exe crash last time.
|
||||||
string lockFile = Path.Combine(targetPath, ".git\\index.lock");
|
string lockFile = Path.Combine(targetPath, ".git\\index.lock");
|
||||||
if (File.Exists(lockFile))
|
if (File.Exists(lockFile))
|
||||||
{
|
{
|
||||||
@@ -165,7 +165,7 @@ namespace GitHub.Runner.Plugins.Repository.v1_1
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// delete the shallow.lock file left by previous canceled build or any operation cause git.exe crash last time.
|
// delete the shallow.lock file left by previous cancelled build or any operation cause git.exe crash last time.
|
||||||
string shallowLockFile = Path.Combine(targetPath, ".git\\shallow.lock");
|
string shallowLockFile = Path.Combine(targetPath, ".git\\shallow.lock");
|
||||||
if (File.Exists(shallowLockFile))
|
if (File.Exists(shallowLockFile))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ namespace GitHub.Runner.Sdk
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create a new token source for the parallel query. The parallel query should be
|
// Create a new token source for the parallel query. The parallel query should be
|
||||||
// canceled after the first error is encountered. Otherwise the number of exceptions
|
// cancelled after the first error is encountered. Otherwise the number of exceptions
|
||||||
// could get out of control for a large directory with access denied on every file.
|
// could get out of control for a large directory with access denied on every file.
|
||||||
using (var tokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken))
|
using (var tokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -654,7 +654,7 @@ namespace GitHub.Runner.Worker
|
|||||||
actionDownloadInfos = await jobServer.ResolveActionDownloadInfoAsync(executionContext.Global.Plan.ScopeIdentifier, executionContext.Global.Plan.PlanType, executionContext.Global.Plan.PlanId, executionContext.Root.Id, new WebApi.ActionReferenceList { Actions = actionReferences }, executionContext.CancellationToken);
|
actionDownloadInfos = await jobServer.ResolveActionDownloadInfoAsync(executionContext.Global.Plan.ScopeIdentifier, executionContext.Global.Plan.PlanType, executionContext.Global.Plan.PlanId, executionContext.Root.Id, new WebApi.ActionReferenceList { Actions = actionReferences }, executionContext.CancellationToken);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
catch (Exception ex) when (!executionContext.CancellationToken.IsCancellationRequested) // Do not retry if the run is canceled.
|
catch (Exception ex) when (!executionContext.CancellationToken.IsCancellationRequested) // Do not retry if the run is cancelled.
|
||||||
{
|
{
|
||||||
// UnresolvableActionDownloadInfoException is a 422 client error, don't retry
|
// UnresolvableActionDownloadInfoException is a 422 client error, don't retry
|
||||||
// Some possible cases are:
|
// Some possible cases are:
|
||||||
|
|||||||
@@ -299,7 +299,7 @@ namespace GitHub.Runner.Worker.Handlers
|
|||||||
// Register job cancellation call back only if job cancellation token not been fire before each step run
|
// Register job cancellation call back only if job cancellation token not been fire before each step run
|
||||||
if (!ExecutionContext.Root.CancellationToken.IsCancellationRequested)
|
if (!ExecutionContext.Root.CancellationToken.IsCancellationRequested)
|
||||||
{
|
{
|
||||||
// Test the condition again. The job was canceled after the condition was originally evaluated.
|
// Test the condition again. The job was cancelled after the condition was originally evaluated.
|
||||||
jobCancelRegister = ExecutionContext.Root.CancellationToken.Register(() =>
|
jobCancelRegister = ExecutionContext.Root.CancellationToken.Register(() =>
|
||||||
{
|
{
|
||||||
// Mark job as cancelled
|
// Mark job as cancelled
|
||||||
@@ -399,7 +399,7 @@ namespace GitHub.Runner.Worker.Handlers
|
|||||||
jobCancelRegister = null;
|
jobCancelRegister = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Check failed or canceled
|
// Check failed or cancelled
|
||||||
if (step.ExecutionContext.Result == TaskResult.Failed || step.ExecutionContext.Result == TaskResult.Canceled)
|
if (step.ExecutionContext.Result == TaskResult.Failed || step.ExecutionContext.Result == TaskResult.Canceled)
|
||||||
{
|
{
|
||||||
Trace.Info($"Update job result with current composite step result '{step.ExecutionContext.Result}'.");
|
Trace.Info($"Update job result with current composite step result '{step.ExecutionContext.Result}'.");
|
||||||
|
|||||||
@@ -131,9 +131,9 @@ namespace GitHub.Runner.Worker
|
|||||||
}
|
}
|
||||||
catch (OperationCanceledException ex) when (jobContext.CancellationToken.IsCancellationRequested)
|
catch (OperationCanceledException ex) when (jobContext.CancellationToken.IsCancellationRequested)
|
||||||
{
|
{
|
||||||
// set the job to canceled
|
// set the job to cancelled
|
||||||
// don't log error issue to job ExecutionContext, since server owns the job level issue
|
// don't log error issue to job ExecutionContext, since server owns the job level issue
|
||||||
Trace.Error($"Job is canceled during initialize.");
|
Trace.Error($"Job is cancelled during initialize.");
|
||||||
Trace.Error($"Caught exception: {ex}");
|
Trace.Error($"Caught exception: {ex}");
|
||||||
return await CompleteJobAsync(jobServer, jobContext, message, TaskResult.Canceled);
|
return await CompleteJobAsync(jobServer, jobContext, message, TaskResult.Canceled);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ namespace GitHub.Runner.Worker
|
|||||||
// Register job cancellation call back only if job cancellation token not been fire before each step run
|
// Register job cancellation call back only if job cancellation token not been fire before each step run
|
||||||
if (!jobContext.CancellationToken.IsCancellationRequested)
|
if (!jobContext.CancellationToken.IsCancellationRequested)
|
||||||
{
|
{
|
||||||
// Test the condition again. The job was canceled after the condition was originally evaluated.
|
// Test the condition again. The job was cancelled after the condition was originally evaluated.
|
||||||
jobCancelRegister = jobContext.CancellationToken.Register(() =>
|
jobCancelRegister = jobContext.CancellationToken.Register(() =>
|
||||||
{
|
{
|
||||||
// Mark job as cancelled
|
// Mark job as cancelled
|
||||||
|
|||||||
Reference in New Issue
Block a user