mirror of https://github.com/helm/helm.git
fix Chart.yaml handling
Signed-off-by: Matt Farina <matt.farina@suse.com>
This commit is contained in:
parent
5ab8e26c9f
commit
0c64ad1c97
|
|
@ -16,6 +16,7 @@ limitations under the License.
|
|||
package util
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"strings"
|
||||
|
||||
|
|
@ -265,8 +266,8 @@ func processImportValues(c *chart.Chart, merge bool) error {
|
|||
for _, riv := range r.ImportValues {
|
||||
switch iv := riv.(type) {
|
||||
case map[string]interface{}:
|
||||
child := iv["child"].(string)
|
||||
parent := iv["parent"].(string)
|
||||
child := fmt.Sprintf("%v", iv["child"])
|
||||
parent := fmt.Sprintf("%v", iv["parent"])
|
||||
|
||||
outiv = append(outiv, map[string]string{
|
||||
"child": child,
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ limitations under the License.
|
|||
package util
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"strings"
|
||||
|
||||
|
|
@ -265,8 +266,8 @@ func processImportValues(c *chart.Chart, merge bool) error {
|
|||
for _, riv := range r.ImportValues {
|
||||
switch iv := riv.(type) {
|
||||
case map[string]interface{}:
|
||||
child := iv["child"].(string)
|
||||
parent := iv["parent"].(string)
|
||||
child := fmt.Sprintf("%v", iv["child"])
|
||||
parent := fmt.Sprintf("%v", iv["parent"])
|
||||
|
||||
outiv = append(outiv, map[string]string{
|
||||
"child": child,
|
||||
|
|
|
|||
|
|
@ -160,6 +160,9 @@ func validateChartVersion(cf *chart.Metadata) error {
|
|||
|
||||
func validateChartMaintainer(cf *chart.Metadata) error {
|
||||
for _, maintainer := range cf.Maintainers {
|
||||
if maintainer == nil {
|
||||
return errors.New("a maintainer entry is empty")
|
||||
}
|
||||
if maintainer.Name == "" {
|
||||
return errors.New("each maintainer requires a name")
|
||||
} else if maintainer.Email != "" && !govalidator.IsEmail(maintainer.Email) {
|
||||
|
|
|
|||
|
|
@ -142,6 +142,16 @@ func TestValidateChartMaintainer(t *testing.T) {
|
|||
t.Errorf("validateChartMaintainer(%s, %s) to return no error, got %s", test.Name, test.Email, err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
// Testing for an empty maintainer
|
||||
badChart.Maintainers = []*chart.Maintainer{nil}
|
||||
err := validateChartMaintainer(badChart)
|
||||
if err == nil {
|
||||
t.Errorf("validateChartMaintainer did not return error for nil maintainer as expected")
|
||||
}
|
||||
if err.Error() != "a maintainer entry is empty" {
|
||||
t.Errorf("validateChartMaintainer returned unexpected error for nil maintainer: %s", err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateChartSources(t *testing.T) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue