fix: include-needs should only include direct dependencies, not transitive

- Fix collectDirectNeedsOnly to correctly match needs by full ID
- Fix PlanReleases to respect SelectedReleases when provided
- Fix unmarkNeedsDirectOnly to use full release IDs
- Update tests to expect correct behavior for include-needs vs include-transitive-needs
- Add SkipNeeds flag when needs are pre-included in withNeeds

This fixes CI issues in PR #2485

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 3815ce1143
commit 2542988fbc
44 changed files with 288 additions and 239 deletions
@@ -12,16 +12,20 @@ GROUP RELEASES
invoking preapply hooks for releases in group 1/2: default//bar
invoking preapply hooks for releases in group 2/2: default//foo
processing 1 groups of releases in this order:
processing 2 groups of releases in this order:
GROUP RELEASES
1 default//bar
2 default//foo
processing releases in group 1/1: default//bar
processing 1 groups of releases in this order:
processing releases in group 1/2: default//bar
processing releases in group 2/2: default//foo
processing 2 groups of releases in this order:
GROUP RELEASES
1 default//foo
2 default//bar
processing releases in group 1/1: default//foo
processing releases in group 1/2: default//foo
processing releases in group 2/2: default//bar
UPDATED RELEASES:
NAME NAMESPACE CHART VERSION DURATION
@@ -14,16 +14,20 @@ GROUP RELEASES
invoking preapply hooks for releases in group 1/2: default//foo
invoking preapply hooks for releases in group 2/2: default//bar
processing 1 groups of releases in this order:
GROUP RELEASES
1 default//bar
processing releases in group 1/1: default//bar
processing 1 groups of releases in this order:
processing 2 groups of releases in this order:
GROUP RELEASES
1 default//foo
2 default//bar
processing releases in group 1/1: default//foo
processing releases in group 1/2: default//foo
processing releases in group 2/2: default//bar
processing 2 groups of releases in this order:
GROUP RELEASES
1 default//bar
2 default//foo
processing releases in group 1/2: default//bar
processing releases in group 2/2: default//foo
WARNING: release foo needs bar, but bar is not installed due to installed: false. Either mark bar as installed or remove bar from foo's needs
UPDATED RELEASES:
@@ -14,16 +14,20 @@ GROUP RELEASES
invoking preapply hooks for releases in group 1/2: default//bar
invoking preapply hooks for releases in group 2/2: default//foo
processing 1 groups of releases in this order:
GROUP RELEASES
1 default//foo
processing releases in group 1/1: default//foo
processing 1 groups of releases in this order:
processing 2 groups of releases in this order:
GROUP RELEASES
1 default//bar
2 default//foo
processing releases in group 1/1: default//bar
processing releases in group 1/2: default//bar
processing releases in group 2/2: default//foo
processing 2 groups of releases in this order:
GROUP RELEASES
1 default//foo
2 default//bar
processing releases in group 1/2: default//foo
processing releases in group 2/2: default//bar
WARNING: release bar needs foo, but foo is not installed due to installed: false. Either mark foo as installed or remove foo from bar's needs
UPDATED RELEASES:
@@ -12,16 +12,20 @@ GROUP RELEASES
invoking preapply hooks for releases in group 1/2: default//foo
invoking preapply hooks for releases in group 2/2: default//bar
processing 1 groups of releases in this order:
processing 2 groups of releases in this order:
GROUP RELEASES
1 default//foo
2 default//bar
processing releases in group 1/1: default//foo
processing 1 groups of releases in this order:
processing releases in group 1/2: default//foo
processing releases in group 2/2: default//bar
processing 2 groups of releases in this order:
GROUP RELEASES
1 default//bar
2 default//foo
processing releases in group 1/1: default//bar
processing releases in group 1/2: default//bar
processing releases in group 2/2: default//foo
UPDATED RELEASES:
NAME NAMESPACE CHART VERSION DURATION
+15 -9
View File
@@ -25,26 +25,32 @@ invoking preapply hooks for releases in group 2/5: default//backend-v1, default/
invoking preapply hooks for releases in group 3/5: default//anotherbackend
invoking preapply hooks for releases in group 4/5: default//database, default//servicemesh
invoking preapply hooks for releases in group 5/5: default//logging, default//front-proxy
processing 2 groups of releases in this order:
processing 5 groups of releases in this order:
GROUP RELEASES
1 default//frontend-v1
2 default//backend-v1
1 default//frontend-v1, default//frontend-v2, default//frontend-v3
2 default//backend-v1, default//backend-v2
3 default//anotherbackend
4 default//database, default//servicemesh
5 default//logging, default//front-proxy
processing releases in group 1/2: default//frontend-v1
processing releases in group 2/2: default//backend-v1
processing releases in group 1/5: default//frontend-v1, default//frontend-v2, default//frontend-v3
processing releases in group 2/5: default//backend-v1, default//backend-v2
processing releases in group 3/5: default//anotherbackend
processing releases in group 4/5: default//database, default//servicemesh
processing releases in group 5/5: default//logging, default//front-proxy
processing 5 groups of releases in this order:
GROUP RELEASES
1 default//logging, default//front-proxy
2 default//database, default//servicemesh
3 default//anotherbackend
4 default//backend-v2
5 default//frontend-v3
4 default//backend-v1, default//backend-v2
5 default//frontend-v1, default//frontend-v2, default//frontend-v3
processing releases in group 1/5: default//logging, default//front-proxy
processing releases in group 2/5: default//database, default//servicemesh
processing releases in group 3/5: default//anotherbackend
processing releases in group 4/5: default//backend-v2
processing releases in group 5/5: default//frontend-v3
processing releases in group 4/5: default//backend-v1, default//backend-v2
processing releases in group 5/5: default//frontend-v1, default//frontend-v2, default//frontend-v3
UPDATED RELEASES:
NAME NAMESPACE CHART VERSION DURATION
@@ -13,17 +13,19 @@ GROUP RELEASES
invoking preapply hooks for releases in group 1/2: default/ns1/foo
invoking preapply hooks for releases in group 2/2: default/ns1/bar, default/ns2/bar
processing 1 groups of releases in this order:
GROUP RELEASES
1 default/ns2/bar
processing releases in group 1/1: default/ns2/bar
processing 2 groups of releases in this order:
GROUP RELEASES
1 default/ns1/bar
1 default/ns1/foo
2 default/ns1/bar, default/ns2/bar
processing releases in group 1/2: default/ns1/foo
processing releases in group 2/2: default/ns1/bar, default/ns2/bar
processing 2 groups of releases in this order:
GROUP RELEASES
1 default/ns1/bar, default/ns2/bar
2 default/ns1/foo
processing releases in group 1/2: default/ns1/bar
processing releases in group 1/2: default/ns1/bar, default/ns2/bar
getting deployed release version failed: Failed to get the version for: mychart2
processing releases in group 2/2: default/ns1/foo
getting deployed release version failed: Failed to get the version for: mychart1