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

Fix helm-extra-set-args in YAML configuration (#713)

Currently, `helm-extra-set-args` is only available as a command-line
flag, despite being part of the config object. This does not appear to
be documented.

This changes sources the value `extraSetArgs` via the `config` object
rather than the cmd.Flags() only.

Signed-off-by: Dylan Arbour <arbourd@users.noreply.github.com>
This commit is contained in:
Dylan Arbour
2025-06-03 02:26:27 -04:00
committed by GitHub
parent 684da6a043
commit d576e67e39
5 changed files with 7 additions and 16 deletions

View File

@@ -96,11 +96,7 @@ func install(cmd *cobra.Command, _ []string) error {
return fmt.Errorf("failed loading configuration: %w", err)
}
extraSetArgs, err := cmd.Flags().GetString("helm-extra-set-args")
if err != nil {
return err
}
testing, err := chart.NewTesting(*configuration, extraSetArgs)
testing, err := chart.NewTesting(*configuration)
if err != nil {
fmt.Println(err)
}

View File

@@ -90,8 +90,7 @@ func lint(cmd *cobra.Command, _ []string) error {
return fmt.Errorf("failed loading configuration: %w", err)
}
emptyExtraSetArgs := ""
testing, err := chart.NewTesting(*configuration, emptyExtraSetArgs)
testing, err := chart.NewTesting(*configuration)
if err != nil {
return err
}

View File

@@ -51,11 +51,7 @@ func lintAndInstall(cmd *cobra.Command, _ []string) error {
return fmt.Errorf("failed loading configuration: %w", err)
}
extraSetArgs, err := cmd.Flags().GetString("helm-extra-set-args")
if err != nil {
return err
}
testing, err := chart.NewTesting(*configuration, extraSetArgs)
testing, err := chart.NewTesting(*configuration)
if err != nil {
return err
}

View File

@@ -50,8 +50,7 @@ func listChanged(cmd *cobra.Command, _ []string) error {
return fmt.Errorf("failed loading configuration: %w", err)
}
emptyExtraSetArgs := ""
testing, err := chart.NewTesting(*configuration, emptyExtraSetArgs)
testing, err := chart.NewTesting(*configuration)
if err != nil {
return err
}

View File

@@ -266,14 +266,15 @@ type TestResult struct {
}
// NewTesting creates a new Testing struct with the given config.
func NewTesting(config config.Configuration, extraSetArgs string) (Testing, error) {
func NewTesting(config config.Configuration) (Testing, error) {
procExec := exec.NewProcessExecutor(config.Debug)
helmExtraArgs := strings.Fields(config.HelmExtraArgs)
helmExtraSetArgs := strings.Fields(config.HelmExtraSetArgs)
helmLintExtraArgs := strings.Fields(config.HelmLintExtraArgs)
testing := Testing{
config: config,
helm: tool.NewHelm(procExec, helmExtraArgs, helmLintExtraArgs, strings.Fields(extraSetArgs)),
helm: tool.NewHelm(procExec, helmExtraArgs, helmLintExtraArgs, helmExtraSetArgs),
git: tool.NewGit(procExec),
kubectl: tool.NewKubectl(procExec, config.KubectlTimeout),
linter: tool.NewLinter(procExec),