chore: Emit "cleanup" events later to match the behavior in "apply" (#2522)

This changes the behaviour of the cleanup event during sync to be
triggered right before the function exits and matches the behaviour of
apply

Signed-off-by: Niklas Ott <niklas.ott@unwired.at>
Co-authored-by: Raphael Luba <raphael@leanbyte.com>
This commit is contained in:
Niklas
2026-05-08 08:12:35 +08:00
committed by GitHub
co-authored by Raphael Luba
parent 86066cbf98
commit 997051bba4
+7 -7
View File
@@ -2269,13 +2269,6 @@ func (a *App) SyncState(r *Run, c SyncConfigProvider) (bool, []error) {
}
}
for id := range releasesWithNoChange {
r := releasesWithNoChange[id]
if _, err := st.TriggerCleanupEvent(&r, "sync"); err != nil {
a.Logger.Warnf("warn: %v\n", err)
}
}
names := []string{}
for _, r := range releasesToUpdate {
names = append(names, fmt.Sprintf(" %s (%s) UPDATED", r.Name, r.Chart))
@@ -2378,6 +2371,13 @@ Do you really want to sync?
affectedReleases.DisplayAffectedReleases(c.Logger())
for id := range releasesWithNoChange {
r := releasesWithNoChange[id]
if _, err := st.TriggerCleanupEvent(&r, "sync"); err != nil {
a.Logger.Warnf("warn: %v\n", err)
}
}
return true, errs
}