From 49b04976f43be7d4122ba313db2193f303d1e8b7 Mon Sep 17 00:00:00 2001 From: Vallie Joseph Date: Thu, 11 May 2023 14:57:24 -0400 Subject: [PATCH] Adding Consistency to 'Failed To Resolve Action Download Info' Infrastructure Error Flagging (#2488) * adding extra catch for download failure in composite actions * Adding infra error * Adding error handling centralizing * updating try catch bubbling * cleaning up commits * cleaning up commits * cleaning up commits * updating bubbler * cleaning up test files * Fixing linting errors * updating exception bubble * reverting composite * updating catch to not exclude other exceptions * removing uneeded import * Update src/Runner.Worker/ActionRunner.cs Co-authored-by: Tingluo Huang * Update src/Runner.Worker/ActionManager.cs Co-authored-by: Tingluo Huang * Update src/Runner.Worker/ActionManager.cs Co-authored-by: Tingluo Huang * Update src/Runner.Worker/ActionManager.cs Co-authored-by: Tingluo Huang * Update src/Runner.Worker/ActionManager.cs Co-authored-by: Tingluo Huang * moving download out of for loop; reverting exception wrap * Update src/Runner.Worker/ActionManager.cs Co-authored-by: Tingluo Huang * Adding blank lines back * Adding blank lines back * removing uneeded catch for download fail * adding var back for consistency * formatting clean --------- Co-authored-by: Tingluo Huang --- src/Runner.Worker/ActionManager.cs | 15 ++++++++++++++- src/Runner.Worker/JobExtension.cs | 8 -------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/Runner.Worker/ActionManager.cs b/src/Runner.Worker/ActionManager.cs index ad39efb91..6f7a0cb86 100644 --- a/src/Runner.Worker/ActionManager.cs +++ b/src/Runner.Worker/ActionManager.cs @@ -18,6 +18,7 @@ using GitHub.Services.Common; using WebApi = GitHub.DistributedTask.WebApi; using Pipelines = GitHub.DistributedTask.Pipelines; using PipelineTemplateConstants = GitHub.DistributedTask.Pipelines.ObjectTemplating.PipelineTemplateConstants; +using GitHub.DistributedTask.WebApi; namespace GitHub.Runner.Worker { @@ -101,7 +102,19 @@ namespace GitHub.Runner.Worker } IEnumerable actions = steps.OfType(); executionContext.Output("Prepare all required actions"); - var result = await PrepareActionsRecursiveAsync(executionContext, state, actions, depth, rootStepId); + PrepareActionsState result = new PrepareActionsState(); + try + { + result = await PrepareActionsRecursiveAsync(executionContext, state, actions, depth, rootStepId); + } + catch (FailedToResolveActionDownloadInfoException ex) + { + // Log the error and fail the PrepareActionsAsync Initialization. + Trace.Error($"Caught exception from PrepareActionsAsync Initialization: {ex}"); + executionContext.InfrastructureError(ex.Message); + executionContext.Result = TaskResult.Failed; + throw; + } if (!FeatureManager.IsContainerHooksEnabled(executionContext.Global.Variables)) { if (state.ImagesToPull.Count > 0) diff --git a/src/Runner.Worker/JobExtension.cs b/src/Runner.Worker/JobExtension.cs index 42e6fea81..75789f899 100644 --- a/src/Runner.Worker/JobExtension.cs +++ b/src/Runner.Worker/JobExtension.cs @@ -431,14 +431,6 @@ namespace GitHub.Runner.Worker context.Result = TaskResult.Canceled; throw; } - catch (FailedToResolveActionDownloadInfoException ex) - { - // Log the error and fail the JobExtension Initialization. - Trace.Error($"Caught exception from JobExtenion Initialization: {ex}"); - context.InfrastructureError(ex.Message); - context.Result = TaskResult.Failed; - throw; - } catch (Exception ex) { // Log the error and fail the JobExtension Initialization.