From 2d7d92eaba299b3729bae3a41e56f17ebaa0ac1f Mon Sep 17 00:00:00 2001 From: Aadi jindal <111938909+Aadijindal07@users.noreply.github.com> Date: Thu, 2 Feb 2023 20:52:33 +0530 Subject: [PATCH] solved post-upgrade hooks inconsistent behavior fixed post-install/post-upgrade hooks work have inconsistent behavior based on the --wait flag #11778 Signed-off-by: Aadi jindal <111938909+Aadijindal07@users.noreply.github.com> --- pkg/action/install.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pkg/action/install.go b/pkg/action/install.go index 425b66f69..cadfe37eb 100644 --- a/pkg/action/install.go +++ b/pkg/action/install.go @@ -378,6 +378,22 @@ func (i *Install) performInstall(c chan<- resultMessage, rel *release.Release, t return } } + + if !i.Wait && !i.DisableHooks { + // Check if there are any post-* hooks + hasPostHooks := false + for _, hook := range release.Hooks { + if strings.HasPrefix(hook.Kind, "post-") { + hasPostHooks = true + break + } + } + + // Enable wait flag if there are post-* hooks + if hasPostHooks { + i.Wait = true + } + } if i.Wait { if i.WaitForJobs { @@ -400,6 +416,7 @@ func (i *Install) performInstall(c chan<- resultMessage, rel *release.Release, t } } + if len(i.Description) > 0 { rel.SetStatus(release.StatusDeployed, i.Description) } else {