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

Add option to exclude deprecated charts (#280)

This commit is contained in:
Eric
2020-10-27 03:44:13 -04:00
committed by GitHub
parent 285f25e67e
commit ec7b0c779b
6 changed files with 12 additions and 2 deletions

View File

@@ -74,6 +74,7 @@ func addCommonFlags(flags *pflag.FlagSet) {
flags.Bool("print-config", false, heredoc.Doc(`
Prints the configuration to stderr (caution: setting this may
expose sensitive data when helm-repo-extra-args contains passwords)`))
flags.Bool("exclude-deprecated", false, "Skip charts that are marked as deprecated")
}
func addCommonLintAndInstallFlags(flags *pflag.FlagSet) {

View File

@@ -304,7 +304,12 @@ func (t *Testing) processCharts(action func(chart *Chart) TestResult) ([]TestRes
if err != nil {
return nil, err
}
charts = append(charts, chart)
if t.config.ExcludeDeprecated && chart.yaml.Deprecated {
fmt.Printf("Chart '%s' is deprecated and will be ignored because '--exclude-deprecated' is set\n", chart.String())
} else {
charts = append(charts, chart)
}
}
fmt.Println()

View File

@@ -64,6 +64,7 @@ type Configuration struct {
SkipMissingValues bool `mapstructure:"skip-missing-values"`
Namespace string `mapstructure:"namespace"`
ReleaseLabel string `mapstructure:"release-label"`
ExcludeDeprecated bool `mapstructure:"exclude-deprecated"`
}
func LoadConfiguration(cfgFile string, cmd *cobra.Command, printConfig bool) (*Configuration, error) {

View File

@@ -53,4 +53,5 @@ func loadAndAssertConfigFromFile(t *testing.T, configFile string) {
require.Equal(t, true, cfg.SkipMissingValues)
require.Equal(t, "default", cfg.Namespace)
require.Equal(t, "release", cfg.ReleaseLabel)
require.Equal(t, true, cfg.ExcludeDeprecated)
}

View File

@@ -28,5 +28,6 @@
"upgrade": true,
"skip-missing-values": true,
"namespace": "default",
"release-label": "release"
"release-label": "release",
"exclude-deprecated": true
}

View File

@@ -24,3 +24,4 @@ upgrade: true
skip-missing-values: true
namespace: default
release-label: release
exclude-deprecated: true