mirror of
https://github.com/helmfile/helmfile.git
synced 2026-10-19 01:01:17 +02:00
fix: --include-needs should only include direct dependencies (#1003)
--include-needs was incorrectly including transitive dependencies when
it should only include direct dependencies per the documentation.
The issue was that ChartPrepareOptions.IncludeTransitiveNeeds was being
set to c.IncludeNeeds() instead of c.IncludeTransitiveNeeds() in the
chart preparation phase for diff, template, lint, sync, and apply commands.
This fix ensures:
- --include-needs includes only direct dependencies
- --include-transitive-needs includes both direct and transitive dependencies
Fixes #1003
Signed-off-by: yxxhero <yxxhero@users.noreply.github.com>
Signed-off-by: yxxhero <aiopsclub@163.com>
(cherry picked from commit 7a2cbeebb8)
Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
# Test Case: include-needs vs include-transitive-needs
|
||||
|
||||
This test case validates the fix for issue #1003.
|
||||
|
||||
## Issue
|
||||
`--include-needs` flag was incorrectly including transitive dependencies when it should only include direct dependencies.
|
||||
|
||||
## Expected Behavior
|
||||
|
||||
### --include-needs
|
||||
When selecting `release3` with `--include-needs`:
|
||||
- **Should include**: `release2` (direct dependency) and `release3` (selected release)
|
||||
- **Should NOT include**: `release1` (transitive dependency of release3 through release2)
|
||||
|
||||
### --include-transitive-needs
|
||||
When selecting `release3` with `--include-transitive-needs`:
|
||||
- **Should include**: `release1`, `release2`, and `release3` (all dependencies in the chain)
|
||||
|
||||
## Dependency Chain
|
||||
```
|
||||
release1 (no dependencies)
|
||||
↑
|
||||
release2 (needs release1)
|
||||
↑
|
||||
release3 (needs release2)
|
||||
```
|
||||
|
||||
## Tests Performed
|
||||
1. `helmfile template --include-needs` - verifies only direct dependencies are included
|
||||
2. `helmfile template --include-transitive-needs` - verifies all dependencies are included
|
||||
3. `helmfile lint --include-needs` - verifies consistency across commands
|
||||
4. `helmfile diff --include-needs` - verifies consistency across commands
|
||||
|
||||
## References
|
||||
- Issue: https://github.com/helmfile/helmfile/issues/1003
|
||||
@@ -0,0 +1,23 @@
|
||||
repositories:
|
||||
- name: incubator
|
||||
url: https://charts.helm.sh/incubator
|
||||
|
||||
releases:
|
||||
# release1 has no dependencies - this is a transitive dependency of release3
|
||||
- name: release1
|
||||
chart: incubator/raw
|
||||
namespace: default
|
||||
|
||||
# release2 depends on release1 - this is a direct dependency of release3
|
||||
- name: release2
|
||||
chart: incubator/raw
|
||||
namespace: default
|
||||
needs:
|
||||
- default/release1
|
||||
|
||||
# release3 depends on release2 (and transitively on release1)
|
||||
- name: release3
|
||||
chart: incubator/raw
|
||||
namespace: default
|
||||
needs:
|
||||
- default/release2
|
||||
Reference in New Issue
Block a user