From 934027da602a08ce425ddf8946858d71f7b3cc35 Mon Sep 17 00:00:00 2001 From: ruvceskistefan <96768603+ruvceskistefan@users.noreply.github.com> Date: Wed, 23 Feb 2022 15:48:24 +0100 Subject: [PATCH] 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 --- src/Runner.Listener/JobDispatcher.cs | 8 ++++---- src/Runner.Listener/SelfUpdater.cs | 2 +- src/Runner.Plugins/Repository/v1.0/GitSourceProvider.cs | 4 ++-- src/Runner.Plugins/Repository/v1.1/GitSourceProvider.cs | 4 ++-- src/Runner.Sdk/Util/IOUtil.cs | 2 +- src/Runner.Worker/ActionManager.cs | 2 +- src/Runner.Worker/Handlers/CompositeActionHandler.cs | 4 ++-- src/Runner.Worker/JobRunner.cs | 4 ++-- src/Runner.Worker/StepsRunner.cs | 2 +- 9 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/Runner.Listener/JobDispatcher.cs b/src/Runner.Listener/JobDispatcher.cs index 7b75c72ef..7913c9228 100644 --- a/src/Runner.Listener/JobDispatcher.cs +++ b/src/Runner.Listener/JobDispatcher.cs @@ -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. // 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 @@ -363,7 +363,7 @@ namespace GitHub.Runner.Listener Trace.Info($"Start renew job request {requestId} for job {message.JobId}."); 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 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(); // 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; } catch (Exception ex) @@ -762,7 +762,7 @@ namespace GitHub.Runner.Listener } 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 diff --git a/src/Runner.Listener/SelfUpdater.cs b/src/Runner.Listener/SelfUpdater.cs index 13d0383fc..ae6d780af 100644 --- a/src/Runner.Listener/SelfUpdater.cs +++ b/src/Runner.Listener/SelfUpdater.cs @@ -504,7 +504,7 @@ namespace GitHub.Runner.Listener } catch (OperationCanceledException) when (token.IsCancellationRequested) { - Trace.Info($"Runner download has been canceled."); + Trace.Info($"Runner download has been cancelled."); throw; } catch (Exception ex) diff --git a/src/Runner.Plugins/Repository/v1.0/GitSourceProvider.cs b/src/Runner.Plugins/Repository/v1.0/GitSourceProvider.cs index 5f776723c..b762cafcb 100644 --- a/src/Runner.Plugins/Repository/v1.0/GitSourceProvider.cs +++ b/src/Runner.Plugins/Repository/v1.0/GitSourceProvider.cs @@ -166,7 +166,7 @@ namespace GitHub.Runner.Plugins.Repository.v1_0 } 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"); 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"); if (File.Exists(shallowLockFile)) { diff --git a/src/Runner.Plugins/Repository/v1.1/GitSourceProvider.cs b/src/Runner.Plugins/Repository/v1.1/GitSourceProvider.cs index f7f4bfaaf..539b2b763 100644 --- a/src/Runner.Plugins/Repository/v1.1/GitSourceProvider.cs +++ b/src/Runner.Plugins/Repository/v1.1/GitSourceProvider.cs @@ -150,7 +150,7 @@ namespace GitHub.Runner.Plugins.Repository.v1_1 } 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"); 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"); if (File.Exists(shallowLockFile)) { diff --git a/src/Runner.Sdk/Util/IOUtil.cs b/src/Runner.Sdk/Util/IOUtil.cs index a4b98e70d..521998a97 100644 --- a/src/Runner.Sdk/Util/IOUtil.cs +++ b/src/Runner.Sdk/Util/IOUtil.cs @@ -108,7 +108,7 @@ namespace GitHub.Runner.Sdk } // 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. using (var tokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken)) { diff --git a/src/Runner.Worker/ActionManager.cs b/src/Runner.Worker/ActionManager.cs index 1a89bca00..954d9a691 100644 --- a/src/Runner.Worker/ActionManager.cs +++ b/src/Runner.Worker/ActionManager.cs @@ -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); 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 // Some possible cases are: diff --git a/src/Runner.Worker/Handlers/CompositeActionHandler.cs b/src/Runner.Worker/Handlers/CompositeActionHandler.cs index 45c9900fc..425d19892 100644 --- a/src/Runner.Worker/Handlers/CompositeActionHandler.cs +++ b/src/Runner.Worker/Handlers/CompositeActionHandler.cs @@ -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 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(() => { // Mark job as cancelled @@ -399,7 +399,7 @@ namespace GitHub.Runner.Worker.Handlers jobCancelRegister = null; } } - // Check failed or canceled + // Check failed or cancelled if (step.ExecutionContext.Result == TaskResult.Failed || step.ExecutionContext.Result == TaskResult.Canceled) { Trace.Info($"Update job result with current composite step result '{step.ExecutionContext.Result}'."); diff --git a/src/Runner.Worker/JobRunner.cs b/src/Runner.Worker/JobRunner.cs index a4bba12ac..74b142885 100644 --- a/src/Runner.Worker/JobRunner.cs +++ b/src/Runner.Worker/JobRunner.cs @@ -131,9 +131,9 @@ namespace GitHub.Runner.Worker } 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 - Trace.Error($"Job is canceled during initialize."); + Trace.Error($"Job is cancelled during initialize."); Trace.Error($"Caught exception: {ex}"); return await CompleteJobAsync(jobServer, jobContext, message, TaskResult.Canceled); } diff --git a/src/Runner.Worker/StepsRunner.cs b/src/Runner.Worker/StepsRunner.cs index 7b7bc9716..82c9218ba 100644 --- a/src/Runner.Worker/StepsRunner.cs +++ b/src/Runner.Worker/StepsRunner.cs @@ -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 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(() => { // Mark job as cancelled