From 6af9289500ad8f02126a8eb7353bd7e32bcf24d1 Mon Sep 17 00:00:00 2001 From: Aaron Cowdin Date: Thu, 19 Mar 2026 11:41:59 -0700 Subject: [PATCH] Issue #3178 - Fix error output in k8s mode --- .../Container/ContainerHooks/ContainerHookManager.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Runner.Worker/Container/ContainerHooks/ContainerHookManager.cs b/src/Runner.Worker/Container/ContainerHooks/ContainerHookManager.cs index cf4bdfa1b8c..cad6363afa5 100644 --- a/src/Runner.Worker/Container/ContainerHooks/ContainerHookManager.cs +++ b/src/Runner.Worker/Container/ContainerHooks/ContainerHookManager.cs @@ -137,6 +137,7 @@ public string GetContainerHookData() private async Task ExecuteHookScript(IExecutionContext context, HookInput input, ActionRunStage stage, string prependPath) where T : HookResponse { + bool stepFailed = false; try { ValidateHookExecutable(); @@ -167,12 +168,13 @@ private async Task ExecuteHookScript(IExecutionContext context, HookInput await handler.RunAsync(stage); if (handler.ExecutionContext.Result == TaskResult.Failed) { + stepFailed = true; throw new Exception($"The hook script at '{HookScriptPath}' running command '{input.Command}' did not execute successfully"); } var response = GetResponse(input); return response; } - catch (Exception ex) + catch (Exception ex) when (!stepFailed) { throw new Exception($"Executing the custom container implementation failed. Please contact your self hosted runner administrator.", ex); }