From f4f4a6b81fbdb90412bd906fa5458482e94625bd Mon Sep 17 00:00:00 2001 From: Suleiman Dibirov Date: Wed, 30 Oct 2024 18:48:17 +0200 Subject: [PATCH] fix(hooks): correct hooks delete order Signed-off-by: Suleiman Dibirov --- 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..4bffb6ae0 100644 --- a/pkg/action/hooks.go +++ b/pkg/action/hooks.go @@ -99,7 +99,8 @@ func (cfg *Configuration) execHook(rl *release.Release, hook release.HookEvent, // 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 { + for i := len(executingHooks) - 1; i >= 0; i-- { + h := executingHooks[i] if err := cfg.deleteHookByPolicy(h, release.HookSucceeded, timeout); err != nil { return err }