1
0
mirror of https://github.com/helm/chart-testing.git synced 2026-02-05 09:45:14 +01:00

feat(upgrade): using the values instead of --reuse-values (#742)

Signed-off-by: Paolo Gallina <paologallina1992@gmail.com>
This commit is contained in:
PaoloGallina
2025-06-02 10:30:49 +02:00
committed by GitHub
parent 1b168bdf17
commit 5bde7c54d4
3 changed files with 12 additions and 6 deletions

View File

@@ -79,7 +79,8 @@ type Git interface {
// InstallWithValues runs `helm install` for the given chart using the specified values file.
// Pass a zero value for valuesFile in order to run install without specifying a values file.
//
// Upgrade runs `helm upgrade` against an existing release, and re-uses the previously computed values.
// UpgradeWithValues runs `helm upgrade` against an existing release using the specified values file.
// Pass a zero value for valuesFile in order to run install without specifying a values file.
//
// Test runs `helm test` against an existing release. Set the cleanup argument to true in order
// to clean up test pods created by helm after the test command completes.
@@ -91,7 +92,7 @@ type Helm interface {
BuildDependenciesWithArgs(chart string, extraArgs []string) error
LintWithValues(chart string, valuesFile string) error
InstallWithValues(chart string, valuesFile string, namespace string, release string) error
Upgrade(chart string, namespace string, release string) error
UpgradeWithValues(chart string, valuesFile string, namespace string, release string) error
Test(namespace string, release string) error
DeleteRelease(namespace string, release string)
Version() (string, error)
@@ -660,7 +661,7 @@ func (t *Testing) doUpgrade(oldChart, newChart *Chart, oldChartMustPass bool) er
return nil
}
if err := t.helm.Upgrade(newChart.Path(), namespace, release); err != nil {
if err := t.helm.UpgradeWithValues(newChart.Path(), valuesFile, namespace, release); err != nil {
return err
}

View File

@@ -111,7 +111,7 @@ func (h *fakeHelm) LintWithValues(_ string, _ string) error { return nil }
func (h *fakeHelm) InstallWithValues(_ string, _ string, _ string, _ string) error {
return nil
}
func (h *fakeHelm) Upgrade(_ string, _ string, _ string) error {
func (h *fakeHelm) UpgradeWithValues(_ string, _ string, _ string, _ string) error {
return nil
}
func (h *fakeHelm) Test(_ string, _ string) error {

View File

@@ -75,9 +75,14 @@ func (h Helm) InstallWithValues(chart string, valuesFile string, namespace strin
"--wait", values, h.extraArgs, h.extraSetArgs)
}
func (h Helm) Upgrade(chart string, namespace string, release string) error {
func (h Helm) UpgradeWithValues(chart string, valuesFile string, namespace string, release string) error {
var values []string
if valuesFile != "" {
values = []string{"--values", valuesFile}
}
return h.exec.RunProcess("helm", "upgrade", release, chart, "--namespace", namespace,
"--reuse-values", "--wait", h.extraArgs, h.extraSetArgs)
"--wait", values, h.extraArgs, h.extraSetArgs)
}
func (h Helm) Test(namespace string, release string) error {