fix more issues

Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
yxxhero 2026-03-14 14:51:40 +08:00
parent a8a0072fe4
commit f7c35c69c3
8 changed files with 10 additions and 12 deletions

View File

@ -2346,11 +2346,7 @@ func (a *App) withNeeds(r *Run, c DAGConfig, includeDisabled bool, f func(*state
var rels []state.ReleaseSpec
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 {
if _, errs := withDAG(st, r.helm, a.Logger, state.PlanOptions{SelectedReleases: toRender, Reverse: false, SkipNeeds: c.SkipNeeds(), IncludeNeeds: includeNeeds, IncludeTransitiveNeeds: c.IncludeTransitiveNeeds()}, a.WrapWithoutSelector(func(subst *state.HelmState, helm helmexec.Interface) []error {
rels = append(rels, subst.Releases...)
return nil
})); len(errs) > 0 {

View File

@ -1,6 +1,6 @@
merged environment: &{default map[] map[] map[]}
WARNING: release test2 needs disabled, but disabled is not installed due to installed: false. Either mark disabled as installed or remove disabled from test2's needs
2 release(s) matching app=test found in helmfile.yaml
4 release(s) matching app=test found in helmfile.yaml
processing 4 groups of releases in this order:
GROUP RELEASES

View File

@ -1,6 +1,6 @@
merged environment: &{default map[] map[] map[]}
WARNING: release test2 needs disabled, but disabled is not installed due to installed: false. Either mark disabled as installed or remove disabled from test2's needs
1 release(s) matching name=test3 found in helmfile.yaml
2 release(s) matching name=test3 found in helmfile.yaml
processing 2 groups of releases in this order:
GROUP RELEASES

View File

@ -1,6 +1,6 @@
merged environment: &{default map[] map[] map[]}
WARNING: release test2 needs disabled, but disabled is not installed due to installed: false. Either mark disabled as installed or remove disabled from test2's needs
2 release(s) matching app=test found in helmfile.yaml
4 release(s) matching app=test found in helmfile.yaml
processing 4 groups of releases in this order:
GROUP RELEASES

View File

@ -1,6 +1,6 @@
merged environment: &{default map[] map[] map[]}
WARNING: release test2 needs disabled, but disabled is not installed due to installed: false. Either mark disabled as installed or remove disabled from test2's needs
1 release(s) matching name=test3 found in helmfile.yaml
2 release(s) matching name=test3 found in helmfile.yaml
processing 2 groups of releases in this order:
GROUP RELEASES

View File

@ -1,6 +1,6 @@
merged environment: &{default map[] map[] map[]}
WARNING: release test2 needs disabled, but disabled is not installed due to installed: false. Either mark disabled as installed or remove disabled from test2's needs
2 release(s) matching app=test found in helmfile.yaml
4 release(s) matching app=test found in helmfile.yaml
processing 4 groups of releases in this order:
GROUP RELEASES

View File

@ -1,6 +1,6 @@
merged environment: &{default map[] map[] map[]}
WARNING: release test2 needs disabled, but disabled is not installed due to installed: false. Either mark disabled as installed or remove disabled from test2's needs
1 release(s) matching name=test3 found in helmfile.yaml
2 release(s) matching name=test3 found in helmfile.yaml
processing 2 groups of releases in this order:
GROUP RELEASES

View File

@ -2965,6 +2965,7 @@ func (st *HelmState) SelectReleasesWithNeeds(includeTransitiveNeeds bool) ([]Rel
}
func markExcludedReleases(releases []ReleaseSpec, selectors []string, values map[string]any, includeTransitiveNeeds bool, includeNeeds bool) ([]Release, error) {
var filteredReleases []Release
filters := []ReleaseFilter{}
for _, label := range selectors {
@ -3093,7 +3094,8 @@ func collectAllNeedsWithTransitives(filteredReleases []Release, allReleases []Re
func unmarkReleases(toUnmark map[string]struct{}, releases []Release) {
for i, r := range releases {
if _, ok := toUnmark[ReleaseToID(&r.ReleaseSpec)]; ok {
releaseID := ReleaseToID(&r.ReleaseSpec)
if _, ok := toUnmark[releaseID]; ok {
releases[i].Filtered = false
}
}