"show-all-warnings" -> "show-repo-validation-errors"

Signed-off-by: Russell Cousineau <russell.cousineau@xandr.com>
pull/9611/head
Russell Cousineau 4 years ago
parent bfa5d7c0eb
commit b1bef883d4

@ -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") var errNoRepositories = errors.New("no repositories found. You must add one before updating")
type repoUpdateOptions struct { type repoUpdateOptions struct {
showAllWarnings bool showValidationErrors bool
update func([]*repo.ChartRepository, io.Writer, bool, bool) error update func([]*repo.ChartRepository, io.Writer, bool, bool) error
repoFile string repoFile string
repoCache 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. // 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.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 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...") fmt.Fprintln(out, "Hang tight while we grab the latest from your chart repositories...")
var wg sync.WaitGroup var wg sync.WaitGroup
var repoFailList []string var repoFailList []string
@ -126,7 +126,7 @@ func updateCharts(repos []*repo.ChartRepository, out io.Writer, failOnRepoUpdate
go func(re *repo.ChartRepository) { go func(re *repo.ChartRepository) {
defer wg.Done() defer wg.Done()
var err error var err error
if showAllWarnings { if showValidationErrors {
_, err = re.ValidateAndDownloadIndexFile() _, err = re.ValidateAndDownloadIndexFile()
} else { } else {
_, err = re.DownloadIndexFile() _, err = re.DownloadIndexFile()

@ -35,7 +35,7 @@ func TestUpdateCmd(t *testing.T) {
var out bytes.Buffer var out bytes.Buffer
// Instead of using the HTTP updater, we provide our own for this test. // Instead of using the HTTP updater, we provide our own for this test.
// The TestUpdateCharts test verifies the HTTP behavior independently. // 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 { for _, re := range repos {
fmt.Fprintln(out, re.Config.Name) fmt.Fprintln(out, re.Config.Name)
} }
@ -60,7 +60,7 @@ func TestUpdateCmdMultiple(t *testing.T) {
var out bytes.Buffer var out bytes.Buffer
// Instead of using the HTTP updater, we provide our own for this test. // Instead of using the HTTP updater, we provide our own for this test.
// The TestUpdateCharts test verifies the HTTP behavior independently. // 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 { for _, re := range repos {
fmt.Fprintln(out, re.Config.Name) fmt.Fprintln(out, re.Config.Name)
} }
@ -86,7 +86,7 @@ func TestUpdateCmdInvalid(t *testing.T) {
var out bytes.Buffer var out bytes.Buffer
// Instead of using the HTTP updater, we provide our own for this test. // Instead of using the HTTP updater, we provide our own for this test.
// The TestUpdateCharts test verifies the HTTP behavior independently. // 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 { for _, re := range repos {
fmt.Fprintln(out, re.Config.Name) fmt.Fprintln(out, re.Config.Name)
} }

@ -326,7 +326,7 @@ func IndexDirectory(dir, baseURL string) (*IndexFile, error) {
// //
// The source parameter is only used for logging. // The source parameter is only used for logging.
// This will fail if API Version is not set (ErrNoAPIVersion) or if the unmarshal fails. // 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{} i := &IndexFile{}
if len(data) == 0 { if len(data) == 0 {
@ -345,15 +345,15 @@ func loadIndex(data []byte, source string, consolidateWarnings bool) (*IndexFile
} }
if err := cvs[idx].Validate(); err != nil { if err := cvs[idx].Validate(); err != nil {
invalidCharts++ invalidCharts++
if !consolidateWarnings { if !consolidateValidationErrors {
log.Printf("skipping loading invalid entry for chart %q %q from %s: %s", name, cvs[idx].Version, source, err) 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:]...) cvs = append(cvs[:idx], cvs[idx+1:]...)
} }
} }
} }
if invalidCharts > 0 && consolidateWarnings { if invalidCharts > 0 && consolidateValidationErrors {
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) 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() i.SortEntries()
if i.APIVersion == "" { if i.APIVersion == "" {

Loading…
Cancel
Save