You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
helm/pkg/lint/chartfile.go

47 lines
1018 B

package lint
import (
"os"
"path/filepath"
chartutil "github.com/kubernetes/helm/pkg/chart"
)
// Chartfile checks the Chart.yaml file for errors and warnings.
func Chartfile(basepath string) (m []Message) {
m = []Message{}
path := filepath.Join(basepath, "Chart.yaml")
if fi, err := os.Stat(path); err != nil {
m = append(m, Message{Severity: ErrorSev, Text: "Chart.yaml file: " + path + " does not exist"})
return
} else if fi.IsDir() {
m = append(m, Message{Severity: ErrorSev, Text: "Chart.yaml is a directory."})
return
}
cf, err := chartutil.LoadChartfile(path)
if err != nil {
m = append(m, Message{
Severity: ErrorSev,
Text: err.Error(),
})
return
}
if cf.Name == "" {
m = append(m, Message{
Severity: ErrorSev,
Text: "Chart.yaml: 'name' is required",
})
}
if cf.Version == "" || cf.Version == "0.0.0" {
m = append(m, Message{
Severity: ErrorSev,
Text: "Chart.yaml: 'version' is required, and must be greater than 0.0.0",
})
}
return
}