mirror of https://github.com/helm/helm
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.
46 lines
923 B
46 lines
923 B
package lint
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
|
|
chartutil "github.com/deis/tiller/pkg/chart"
|
|
)
|
|
|
|
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: "No Chart.yaml file"})
|
|
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
|
|
}
|