diff --git a/.gitignore b/.gitignore index d1af995a3..65baa9072 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ bin/ vendor/ # Ignores charts pulled for dependency build tests cmd/helm/testdata/testcharts/issue-7233/charts/* +testchart/ \ No newline at end of file diff --git a/pkg/action/package.go b/pkg/action/package.go index 52920956f..65582a825 100644 --- a/pkg/action/package.go +++ b/pkg/action/package.go @@ -21,6 +21,7 @@ import ( "fmt" "io/ioutil" "os" + "regexp" "syscall" "github.com/Masterminds/semver/v3" @@ -61,6 +62,10 @@ func (p *Package) Run(path string, vals map[string]interface{}) (string, error) return "", err } + if matched, _ := regexp.MatchString("^[[:lower:][:digit:]-]+$", ch.Name()); !matched { + return "", errors.New(fmt.Sprintf("Invalid chart name \"%s\". Chart names must be lower case letters and numbers with optionally dashes (-) for separator\n", ch.Name())) + } + // If version is set, modify the version. if p.Version != "" { ch.Metadata.Version = p.Version