|
|
|
@ -36,7 +36,7 @@ import (
|
|
|
|
|
|
|
|
|
|
var longLintHelp = `
|
|
|
|
|
This command takes a path to a chart and runs a series of tests to verify that
|
|
|
|
|
the chart is well-formed.
|
|
|
|
|
the chart and its dependent charts are well-formed.
|
|
|
|
|
|
|
|
|
|
If the linter encounters things that will cause the chart to fail installation,
|
|
|
|
|
it will emit [ERROR] messages. If it encounters issues that break with convention
|
|
|
|
@ -100,14 +100,16 @@ func (l *lintCmd) run() error {
|
|
|
|
|
var total int
|
|
|
|
|
var failures int
|
|
|
|
|
for _, path := range l.paths {
|
|
|
|
|
if linter, err := lintChart(path, rvals, l.namespace, l.strict); err != nil {
|
|
|
|
|
fmt.Println("==> Skipping", path)
|
|
|
|
|
chartPaths := getChartPaths(path)
|
|
|
|
|
for _, chartPath := range chartPaths {
|
|
|
|
|
if linter, err := lintChart(chartPath, rvals, l.namespace, l.strict); err != nil {
|
|
|
|
|
fmt.Println("==> Skipping", chartPath)
|
|
|
|
|
fmt.Println(err)
|
|
|
|
|
if err == errLintNoChart {
|
|
|
|
|
failures = failures + 1
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
fmt.Println("==> Linting", path)
|
|
|
|
|
fmt.Println("==> Linting", chartPath)
|
|
|
|
|
|
|
|
|
|
if len(linter.Messages) == 0 {
|
|
|
|
|
fmt.Println("Lint OK")
|
|
|
|
@ -124,6 +126,7 @@ func (l *lintCmd) run() error {
|
|
|
|
|
}
|
|
|
|
|
fmt.Println("")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
msg := fmt.Sprintf("%d chart(s) linted", total)
|
|
|
|
|
if failures > 0 {
|
|
|
|
@ -135,6 +138,17 @@ func (l *lintCmd) run() error {
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func getChartPaths(root string) []string {
|
|
|
|
|
charts := []string{root}
|
|
|
|
|
filepath.Walk(filepath.Join(root, "charts"), func(path string, info os.FileInfo, err error) error {
|
|
|
|
|
if info != nil && (info.Name() == "Chart.yaml" || strings.HasSuffix(path, ".tgz")) {
|
|
|
|
|
charts = append(charts, filepath.Dir(path))
|
|
|
|
|
}
|
|
|
|
|
return nil
|
|
|
|
|
})
|
|
|
|
|
return charts
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func lintChart(path string, vals []byte, namespace string, strict bool) (support.Linter, error) {
|
|
|
|
|
var chartPath string
|
|
|
|
|
linter := support.Linter{}
|
|
|
|
|