Move preapply code to separate function
Signed-off-by: Anton Bretting <sajfer@gmail.com>
This commit is contained in:
parent
ca7942c751
commit
ea56061609
|
|
@ -790,7 +790,7 @@ func (a *App) visitStates(fileOrDir string, defOpts LoadOpts, converge func(*sta
|
|||
go func() {
|
||||
sig := <-sigs
|
||||
|
||||
errs := []error{fmt.Errorf("Received [%s] to shutdown ", sig)}
|
||||
errs := []error{fmt.Errorf("received [%s] to shutdown ", sig)}
|
||||
_ = context{app: a, st: st, retainValues: defOpts.RetainValuesFiles}.clean(errs)
|
||||
// See http://tldp.org/LDP/abs/html/exitcodes.html
|
||||
switch sig {
|
||||
|
|
@ -1323,28 +1323,9 @@ func (a *App) apply(r *Run, c ApplyConfigProvider) (bool, bool, []error) {
|
|||
}
|
||||
}
|
||||
|
||||
var releasesWithPreApply []state.ReleaseSpec
|
||||
for _, r := range toApplyWithNeeds {
|
||||
release := r
|
||||
for _, hook := range release.Hooks {
|
||||
if slices.Contains(hook.Events, "preapply") {
|
||||
releasesWithPreApply = append(releasesWithPreApply, release)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
releasesWithPreApply := getReleasesWithPreApply(toApplyWithNeeds)
|
||||
|
||||
if len(releasesWithPreApply) > 0 {
|
||||
msg := "Releases with preapply hooks: \n"
|
||||
if infoMsg != nil {
|
||||
msg = fmt.Sprintf("%s%s", *infoMsg, msg)
|
||||
}
|
||||
infoMsg = &msg
|
||||
}
|
||||
for _, release := range releasesWithPreApply {
|
||||
tmp := fmt.Sprintf("%s %s (%s)", *infoMsg, release.Name, release.Chart)
|
||||
infoMsg = &tmp
|
||||
}
|
||||
infoMsg = preApplyInfoMsg(releasesWithPreApply, infoMsg)
|
||||
|
||||
if releasesToBeDeleted == nil && releasesToBeUpdated == nil && releasesWithPreApply == nil {
|
||||
if infoMsg != nil {
|
||||
|
|
|
|||
Loading…
Reference in New Issue