|
|
@ -362,7 +362,7 @@ func loadIndex(data []byte, source string) (*IndexFile, error) {
|
|
|
|
if cvs[idx].APIVersion == "" {
|
|
|
|
if cvs[idx].APIVersion == "" {
|
|
|
|
cvs[idx].APIVersion = chart.APIVersionV1
|
|
|
|
cvs[idx].APIVersion = chart.APIVersionV1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if err := cvs[idx].Validate(); err != nil {
|
|
|
|
if err := cvs[idx].Validate(); ignoreSkippableChartValidationError(err) != nil {
|
|
|
|
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:]...)
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -388,3 +388,23 @@ func jsonOrYamlUnmarshal(b []byte, i interface{}) error {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return yaml.UnmarshalStrict(b, i)
|
|
|
|
return yaml.UnmarshalStrict(b, i)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ignoreSkippableChartValidationError inspect the given error and returns nil if
|
|
|
|
|
|
|
|
// the error isn't important for index loading
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// In particular, charts may introduce validations that don't impact repository indexes
|
|
|
|
|
|
|
|
// And repository indexes may be generated by older/non-complient software, which doesn't
|
|
|
|
|
|
|
|
// conform to all validations.
|
|
|
|
|
|
|
|
func ignoreSkippableChartValidationError(err error) error {
|
|
|
|
|
|
|
|
verr, ok := err.(chart.ValidationError)
|
|
|
|
|
|
|
|
if !ok {
|
|
|
|
|
|
|
|
return err
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// https://github.com/helm/helm/issues/12748 (JFrog repository strips alias field)
|
|
|
|
|
|
|
|
if strings.HasPrefix(verr.Error(), "validation: more than one dependency with name or alias") {
|
|
|
|
|
|
|
|
return nil
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return err
|
|
|
|
|
|
|
|
}
|
|
|
|