mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-05-17 18:25:26 +00:00
Merge pull request #5865 from milkshake308/feat_helm_devel_arg
feat(helm): allow the use of devel alias for helmcharts
This commit is contained in:
@@ -337,6 +337,9 @@ func (p *HelmChartInflationGeneratorPlugin) pullCommand() []string {
|
||||
if p.Version != "" {
|
||||
args = append(args, "--version", p.Version)
|
||||
}
|
||||
if p.Devel {
|
||||
args = append(args, "--devel")
|
||||
}
|
||||
return args
|
||||
}
|
||||
|
||||
|
||||
@@ -99,6 +99,9 @@ type HelmChart struct {
|
||||
|
||||
// debug enables debug output from the Helm chart inflator generator.
|
||||
Debug bool `json:"debug,omitempty" yaml:"debug,omitempty"`
|
||||
|
||||
// allow for devel release to be used.
|
||||
Devel bool `json:"devel,omitempty" yaml:"devel,omitempty"`
|
||||
}
|
||||
|
||||
// HelmChartArgs contains arguments to helm.
|
||||
@@ -194,5 +197,8 @@ func (h HelmChart) AsHelmArgs(absChartHome string) []string {
|
||||
if h.Debug {
|
||||
args = append(args, "--debug")
|
||||
}
|
||||
if h.Devel {
|
||||
args = append(args, "--devel")
|
||||
}
|
||||
return args
|
||||
}
|
||||
|
||||
@@ -77,4 +77,28 @@ func TestAsHelmArgs(t *testing.T) {
|
||||
"-f", "values2",
|
||||
"--debug"})
|
||||
})
|
||||
|
||||
t.Run("use helm-devel", func(t *testing.T) {
|
||||
// We first test that the devel flag is only appended when specified
|
||||
p := types.HelmChart{
|
||||
Name: "chart-name",
|
||||
Version: "1.0.0",
|
||||
Repo: "https://helm.releases.hashicorp.com",
|
||||
ValuesFile: "values",
|
||||
AdditionalValuesFiles: []string{"values1", "values2"},
|
||||
}
|
||||
require.Equal(t, p.AsHelmArgs("/home/charts"),
|
||||
[]string{"template", "--generate-name", "/home/charts/chart-name",
|
||||
"-f", "values",
|
||||
"-f", "values1",
|
||||
"-f", "values2"})
|
||||
|
||||
p.Devel = true
|
||||
require.Equal(t, p.AsHelmArgs("/home/charts"),
|
||||
[]string{"template", "--generate-name", "/home/charts/chart-name",
|
||||
"-f", "values",
|
||||
"-f", "values1",
|
||||
"-f", "values2",
|
||||
"--devel"})
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user