fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
yxxhero 2026-03-19 17:52:49 +08:00
parent ae9ac4182b
commit 2edc0c6240
2 changed files with 16 additions and 5 deletions

View File

@ -120,12 +120,19 @@ func (r *Run) withPreparedCharts(helmfileCommand string, opts state.ChartPrepare
r.ReleaseToChart = releaseToChart
errs := f()
var firstErr error
if len(errs) > 0 {
firstErr = errs[0]
var nonNilErrs []error
for _, e := range errs {
if e != nil {
nonNilErrs = append(nonNilErrs, e)
}
}
_, err = r.state.TriggerGlobalCleanupEvent(helmfileCommand, firstErr)
var firstErr error
if len(nonNilErrs) > 0 {
firstErr = nonNilErrs[0]
}
_, err = r.state.TriggerGlobalCleanupEventWithError(helmfileCommand, firstErr)
return err
}

View File

@ -3105,7 +3105,11 @@ func (st *HelmState) TriggerGlobalPrepareEvent(helmfileCommand string) (bool, er
return st.triggerGlobalReleaseEvent("prepare", nil, helmfileCommand)
}
func (st *HelmState) TriggerGlobalCleanupEvent(helmfileCommand string, evtErr error) (bool, error) {
func (st *HelmState) TriggerGlobalCleanupEvent(helmfileCommand string) (bool, error) {
return st.TriggerGlobalCleanupEventWithError(helmfileCommand, nil)
}
func (st *HelmState) TriggerGlobalCleanupEventWithError(helmfileCommand string, evtErr error) (bool, error) {
return st.triggerGlobalReleaseEvent("cleanup", evtErr, helmfileCommand)
}