From b1bef883d45c3470909a9b1e878e6270ee78bf5b Mon Sep 17 00:00:00 2001 From: Russell Cousineau Date: Mon, 19 Jul 2021 07:21:54 -0700 Subject: [PATCH] "show-all-warnings" -> "show-repo-validation-errors" Signed-off-by: Russell Cousineau --- cmd/helm/repo_update.go | 10 +++++----- cmd/helm/repo_update_test.go | 6 +++--- pkg/repo/index.go | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/cmd/helm/repo_update.go b/cmd/helm/repo_update.go index 3d344b10b..29c1a4cea 100644 --- a/cmd/helm/repo_update.go +++ b/cmd/helm/repo_update.go @@ -41,7 +41,7 @@ To update all the repositories, use 'helm repo update'. var errNoRepositories = errors.New("no repositories found. You must add one before updating") type repoUpdateOptions struct { - showAllWarnings bool + showValidationErrors bool update func([]*repo.ChartRepository, io.Writer, bool, bool) error repoFile string repoCache string @@ -75,7 +75,7 @@ func newRepoUpdateCmd(out io.Writer) *cobra.Command { // This should be deprecated in Helm 4 by update to the behaviour of `helm repo update` command. f.BoolVar(&o.failOnRepoUpdateFail, "fail-on-repo-update-fail", false, "update fails if any of the repository updates fail") - f.BoolVar(&o.showAllWarnings, "show-all-warnings", false, "show every invalid chart while indexing repository") + f.BoolVar(&o.showValidationErrors, "show-repo-validation-errors", false, "show every invalid chart while indexing repository") return cmd } @@ -114,10 +114,10 @@ func (o *repoUpdateOptions) run(out io.Writer, args []string) error { } } - return o.update(repos, out, o.failOnRepoUpdateFail, o.showAllWarnings) + return o.update(repos, out, o.failOnRepoUpdateFail, o.showValidationErrors) } -func updateCharts(repos []*repo.ChartRepository, out io.Writer, failOnRepoUpdateFail bool, showAllWarnings bool) error { +func updateCharts(repos []*repo.ChartRepository, out io.Writer, failOnRepoUpdateFail bool, showValidationErrors bool) error { fmt.Fprintln(out, "Hang tight while we grab the latest from your chart repositories...") var wg sync.WaitGroup var repoFailList []string @@ -126,7 +126,7 @@ func updateCharts(repos []*repo.ChartRepository, out io.Writer, failOnRepoUpdate go func(re *repo.ChartRepository) { defer wg.Done() var err error - if showAllWarnings { + if showValidationErrors { _, err = re.ValidateAndDownloadIndexFile() } else { _, err = re.DownloadIndexFile() diff --git a/cmd/helm/repo_update_test.go b/cmd/helm/repo_update_test.go index 649272b11..1971f4250 100644 --- a/cmd/helm/repo_update_test.go +++ b/cmd/helm/repo_update_test.go @@ -35,7 +35,7 @@ func TestUpdateCmd(t *testing.T) { var out bytes.Buffer // Instead of using the HTTP updater, we provide our own for this test. // The TestUpdateCharts test verifies the HTTP behavior independently. - updater := func(repos []*repo.ChartRepository, out io.Writer, failOnRepoUpdateFail bool, showAllWarnings bool) error { + updater := func(repos []*repo.ChartRepository, out io.Writer, failOnRepoUpdateFail bool, showValidationErrors bool) error { for _, re := range repos { fmt.Fprintln(out, re.Config.Name) } @@ -60,7 +60,7 @@ func TestUpdateCmdMultiple(t *testing.T) { var out bytes.Buffer // Instead of using the HTTP updater, we provide our own for this test. // The TestUpdateCharts test verifies the HTTP behavior independently. - updater := func(repos []*repo.ChartRepository, out io.Writer, failOnRepoUpdateFail bool, showAllWarnings bool) error { + updater := func(repos []*repo.ChartRepository, out io.Writer, failOnRepoUpdateFail bool, showValidationErrors bool) error { for _, re := range repos { fmt.Fprintln(out, re.Config.Name) } @@ -86,7 +86,7 @@ func TestUpdateCmdInvalid(t *testing.T) { var out bytes.Buffer // Instead of using the HTTP updater, we provide our own for this test. // The TestUpdateCharts test verifies the HTTP behavior independently. - updater := func(repos []*repo.ChartRepository, out io.Writer, failOnRepoUpdateFail bool, showAllWarnings bool) error { + updater := func(repos []*repo.ChartRepository, out io.Writer, failOnRepoUpdateFail bool, showValidationErrors bool) error { for _, re := range repos { fmt.Fprintln(out, re.Config.Name) } diff --git a/pkg/repo/index.go b/pkg/repo/index.go index bad1b9b6a..163b2d704 100644 --- a/pkg/repo/index.go +++ b/pkg/repo/index.go @@ -326,7 +326,7 @@ func IndexDirectory(dir, baseURL string) (*IndexFile, error) { // // The source parameter is only used for logging. // This will fail if API Version is not set (ErrNoAPIVersion) or if the unmarshal fails. -func loadIndex(data []byte, source string, consolidateWarnings bool) (*IndexFile, error) { +func loadIndex(data []byte, source string, consolidateValidationErrors bool) (*IndexFile, error) { i := &IndexFile{} if len(data) == 0 { @@ -345,15 +345,15 @@ func loadIndex(data []byte, source string, consolidateWarnings bool) (*IndexFile } if err := cvs[idx].Validate(); err != nil { invalidCharts++ - if !consolidateWarnings { + if !consolidateValidationErrors { log.Printf("skipping loading invalid entry for chart %q %q from %s: %s", name, cvs[idx].Version, source, err) } cvs = append(cvs[:idx], cvs[idx+1:]...) } } } - if invalidCharts > 0 && consolidateWarnings { - log.Printf("skipped loading %d invalid chart entries from %s\nrun 'helm repo update --show-all-warnings' for full list of invalid entries", invalidCharts, source) + if invalidCharts > 0 && consolidateValidationErrors { + log.Printf("skipped loading %d invalid chart entries from %s\nrun 'helm repo update --show-repo-validation-errors' for full list of invalid entries", invalidCharts, source) } i.SortEntries() if i.APIVersion == "" {