From acb7699c65e07ffb58281f42d1504969c268fa9e Mon Sep 17 00:00:00 2001 From: Samir Shetty Date: Fri, 6 Aug 2021 15:08:20 -0700 Subject: [PATCH] Hooks with the same Weight but different Kind should not be compared by Name Signed-off-by: Samir Shetty --- pkg/action/hooks.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/action/hooks.go b/pkg/action/hooks.go index 40c1ffdb6..1af6b21d4 100644 --- a/pkg/action/hooks.go +++ b/pkg/action/hooks.go @@ -38,7 +38,7 @@ func (cfg *Configuration) execHook(rl *release.Release, hook release.HookEvent, } } - // hooke are pre-ordered by kind, so keep order stable + // hooks are pre-ordered by kind, so keep order stable sort.Stable(hookByWeight(executingHooks)) for _, h := range executingHooks { @@ -113,7 +113,7 @@ type hookByWeight []*release.Hook func (x hookByWeight) Len() int { return len(x) } func (x hookByWeight) Swap(i, j int) { x[i], x[j] = x[j], x[i] } func (x hookByWeight) Less(i, j int) bool { - if x[i].Weight == x[j].Weight { + if x[i].Weight == x[j].Weight && x[i].Kind == x[j].Kind { return x[i].Name < x[j].Name } return x[i].Weight < x[j].Weight