Fix include-needs to correctly handle direct vs transitive dependencies

The withNeeds function was calling getSelectedReleases with false, false
for includeNeeds and includeTransitiveNeeds, which caused it to ignore
the --include-needs and --include-transitive-needs flags.

This fix:
1. Computes includeNeeds before calling getSelectedReleases
2. Passes the correct flags to getSelectedReleases
3. Sets st.Releases to selectedAndNeededReleases instead of deduplicated
4. Passes IncludeNeeds=false and IncludeTransitiveNeeds=false to PlanReleases
   since the needs are already included in selectedReleases

Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
yxxhero
2026-03-18 08:25:32 +08:00
committed by yxxhero
parent 2cabadb81e
commit 3815ce1143
2 changed files with 12 additions and 14 deletions
@@ -2,13 +2,11 @@ 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=test2 found in helmfile.yaml
processing 2 groups of releases in this order:
processing 1 groups of releases in this order:
GROUP RELEASES
1 default/kube-system/disabled
2 default//test2
1 default//test2
processing releases in group 1/2: default/kube-system/disabled
processing releases in group 2/2: default//test2
processing releases in group 1/1: default//test2
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
Affected releases are:
disabled (incubator/raw) DELETED