mirror of
https://github.com/helmfile/helmfile.git
synced 2026-09-30 10:11:54 +02:00
feat: bump helm to 3.14.0 (#1295)
This commit is contained in:
+2
-2
@@ -17,8 +17,8 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
HelmRequiredVersion = "v3.12.3"
|
||||
HelmRecommendedVersion = "v3.13.3"
|
||||
HelmRequiredVersion = "v3.13.3"
|
||||
HelmRecommendedVersion = "v3.14.0"
|
||||
HelmDiffRecommendedVersion = "v3.9.2"
|
||||
HelmSecretsRecommendedVersion = "v4.1.1"
|
||||
HelmGitRecommendedVersion = "v0.12.0"
|
||||
|
||||
@@ -63,7 +63,10 @@ func (d *UnresolvedDependencies) Add(chart, url, versionConstraint string) error
|
||||
Repository: url,
|
||||
VersionConstraint: versionConstraint,
|
||||
}
|
||||
return d.add(dep)
|
||||
if !d.contains(dep) {
|
||||
return d.add(dep)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (d *UnresolvedDependencies) add(dep unresolvedChartDependency) error {
|
||||
@@ -77,6 +80,22 @@ func (d *UnresolvedDependencies) add(dep unresolvedChartDependency) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// contains checks if the UnresolvedDependencies contains the specified unresolvedChartDependency.
|
||||
// It returns true if the dependency is found, otherwise it returns false.
|
||||
// fix 'more than one dependency with name or alias "raw"' error since helm v3.14.0
|
||||
func (d *UnresolvedDependencies) contains(dep unresolvedChartDependency) bool {
|
||||
deps := d.deps[dep.ChartName]
|
||||
if deps == nil {
|
||||
return false
|
||||
}
|
||||
for _, existDep := range deps {
|
||||
if existDep.ChartName == dep.ChartName {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (d *UnresolvedDependencies) ToChartRequirements() *ChartRequirements {
|
||||
deps := []unresolvedChartDependency{}
|
||||
|
||||
|
||||
@@ -64,3 +64,71 @@ func TestGetUnresolvedDependenciess(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestContains(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
dep unresolvedChartDependency
|
||||
deps map[string][]unresolvedChartDependency
|
||||
expected bool
|
||||
}{
|
||||
{
|
||||
name: "existing dependency with right item",
|
||||
dep: unresolvedChartDependency{
|
||||
ChartName: "abc",
|
||||
Repository: "oci://localhost:5000/aaa",
|
||||
VersionConstraint: "0.1.0",
|
||||
},
|
||||
deps: map[string][]unresolvedChartDependency{
|
||||
"abc": {
|
||||
{
|
||||
ChartName: "abc",
|
||||
Repository: "oci://localhost:5000/aaa",
|
||||
VersionConstraint: "0.1.0",
|
||||
},
|
||||
},
|
||||
},
|
||||
expected: true,
|
||||
},
|
||||
{
|
||||
name: "existing dependency with empty item",
|
||||
dep: unresolvedChartDependency{
|
||||
ChartName: "ghi",
|
||||
Repository: "oci://localhost:5000/aaa",
|
||||
VersionConstraint: "0.1.0",
|
||||
},
|
||||
deps: map[string][]unresolvedChartDependency{
|
||||
"ghi": {},
|
||||
},
|
||||
expected: false,
|
||||
},
|
||||
{
|
||||
name: "non-existing dependency",
|
||||
dep: unresolvedChartDependency{
|
||||
ChartName: "def",
|
||||
Repository: "oci://localhost:5000/bbb",
|
||||
VersionConstraint: "0.2.0",
|
||||
},
|
||||
deps: map[string][]unresolvedChartDependency{
|
||||
"abc": {
|
||||
{
|
||||
ChartName: "abc",
|
||||
Repository: "oci://localhost:5000/aaa",
|
||||
VersionConstraint: "0.1.0",
|
||||
},
|
||||
},
|
||||
},
|
||||
expected: false,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
d := &UnresolvedDependencies{
|
||||
deps: tt.deps,
|
||||
}
|
||||
actual := d.contains(tt.dep)
|
||||
require.Equal(t, tt.expected, actual)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user