From a978411d23eaddf22e1cbe8201334d4e7663aa59 Mon Sep 17 00:00:00 2001 From: Imri Barr Date: Tue, 11 Jun 2024 10:03:07 +0300 Subject: [PATCH] Fix: Helm chart is removed even if pre-delete hook is failing Signed-off-by: Imri Barr --- pkg/action/hooks.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/action/hooks.go b/pkg/action/hooks.go index 0af625dff..3dd42d0fc 100644 --- a/pkg/action/hooks.go +++ b/pkg/action/hooks.go @@ -66,7 +66,6 @@ func (cfg *Configuration) execHook(rl *release.Release, hook release.HookEvent, StartedAt: helmtime.Now(), Phase: release.HookPhaseRunning, } - cfg.recordRelease(rl) // As long as the implementation of WatchUntilReady does not panic, HookPhaseFailed or HookPhaseSucceeded // should always be set by this function. If we fail to do that for any reason, then HookPhaseUnknown is @@ -97,6 +96,8 @@ func (cfg *Configuration) execHook(rl *release.Release, hook release.HookEvent, h.LastRun.Phase = release.HookPhaseSucceeded } + cfg.recordRelease(rl) + // If all hooks are successful, check the annotation of each hook to determine whether the hook should be deleted // under succeeded condition. If so, then clear the corresponding resource object in each hook for _, h := range executingHooks {