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>
pull/11786/head
Aadi jindal 1 year ago committed by GitHub
parent 5bf273d81b
commit 2d7d92eaba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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 {

Loading…
Cancel
Save