fix: support helm v4 beside v3 and remove -c flag for helm version as it does nothing

features.
This commit is contained in:
hmilkovi
2025-11-15 23:21:35 +01:00
parent 77b3446b36
commit 54848c1049
12 changed files with 218 additions and 65 deletions

View File

@@ -367,9 +367,9 @@ func (p *HelmChartInflationGeneratorPlugin) markHelmGeneratedResources(rm resmap
return nil
}
// checkHelmVersion will return an error if the helm version is not V3
// checkHelmVersion will return an error if the helm version is not V3 or V4
func (p *HelmChartInflationGeneratorPlugin) checkHelmVersion() error {
stdout, err := p.runHelmCommand([]string{"version", "-c", "--short"})
stdout, err := p.runHelmCommand([]string{"version", "--short"})
if err != nil {
return err
}
@@ -385,8 +385,8 @@ func (p *HelmChartInflationGeneratorPlugin) checkHelmVersion() error {
v = v[1:]
}
majorVersion := strings.Split(v, ".")[0]
if majorVersion != "3" {
return fmt.Errorf("this plugin requires helm V3 but got v%s", v)
if majorVersion != "3" && majorVersion != "4" {
return fmt.Errorf("this plugin requires helm V3 or V4 but got v%s", v)
}
return nil
}