mirror of
https://github.com/helmfile/helmfile.git
synced 2026-10-22 10:53:15 +02:00
Fix not to ignore diff selector when it matched nothing
Fixes #327 Signed-off-by: Yusuke Kuoka <ykuoka@gmail.com>
This commit is contained in:
+14
-12
@@ -1866,12 +1866,12 @@ func (a *App) withNeeds(r *Run, c DAGConfig, includeDisabled bool, f func(*state
|
||||
|
||||
var toRender []state.ReleaseSpec
|
||||
|
||||
releasesDisabled := map[string]state.ReleaseSpec{}
|
||||
releasesToUninstall := map[string]state.ReleaseSpec{}
|
||||
for _, r := range selectedReleasesWithNeeds {
|
||||
release := r
|
||||
id := state.ReleaseToID(&release)
|
||||
if release.Installed != nil && !*release.Installed {
|
||||
releasesDisabled[id] = release
|
||||
releasesToUninstall[id] = release
|
||||
} else {
|
||||
toRender = append(toRender, release)
|
||||
}
|
||||
@@ -1879,19 +1879,21 @@ func (a *App) withNeeds(r *Run, c DAGConfig, includeDisabled bool, f func(*state
|
||||
|
||||
var rels []state.ReleaseSpec
|
||||
|
||||
// toRender already contains the direct and transitive needs depending on the DAG options.
|
||||
// That's why we don't pass in `IncludeNeeds: c.IncludeNeeds(), IncludeTransitiveNeeds: c.IncludeTransitiveNeeds()` here.
|
||||
// Otherwise, in case include-needs=true, it will include the needs of needs, which results in unexpectedly introducing transitive needs,
|
||||
// even if include-transitive-needs=true is unspecified.
|
||||
if _, errs := withDAG(st, r.helm, a.Logger, state.PlanOptions{SelectedReleases: toRender, Reverse: false, SkipNeeds: c.SkipNeeds(), IncludeNeeds: includeNeeds}, a.WrapWithoutSelector(func(subst *state.HelmState, helm helmexec.Interface) []error {
|
||||
rels = append(rels, subst.Releases...)
|
||||
return nil
|
||||
})); len(errs) > 0 {
|
||||
return false, errs
|
||||
if len(toRender) > 0 {
|
||||
// toRender already contains the direct and transitive needs depending on the DAG options.
|
||||
// That's why we don't pass in `IncludeNeeds: c.IncludeNeeds(), IncludeTransitiveNeeds: c.IncludeTransitiveNeeds()` here.
|
||||
// Otherwise, in case include-needs=true, it will include the needs of needs, which results in unexpectedly introducing transitive needs,
|
||||
// even if include-transitive-needs=true is unspecified.
|
||||
if _, errs := withDAG(st, r.helm, a.Logger, state.PlanOptions{SelectedReleases: toRender, Reverse: false, SkipNeeds: c.SkipNeeds(), IncludeNeeds: includeNeeds}, a.WrapWithoutSelector(func(subst *state.HelmState, helm helmexec.Interface) []error {
|
||||
rels = append(rels, subst.Releases...)
|
||||
return nil
|
||||
})); len(errs) > 0 {
|
||||
return false, errs
|
||||
}
|
||||
}
|
||||
|
||||
if includeDisabled {
|
||||
for _, d := range releasesDisabled {
|
||||
for _, d := range releasesToUninstall {
|
||||
rels = append(rels, d)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user