return a non 0 exit code when lint fails due to missing Chart.yaml

pull/3783/head
Ryan Hartje 7 years ago
parent 94a5f3a1eb
commit 343acc5a60

@ -97,10 +97,14 @@ func (l *lintCmd) run() error {
var total int var total int
var failures int var failures int
rc := 0
for _, path := range l.paths { for _, path := range l.paths {
if linter, err := lintChart(path, rvals, l.namespace, l.strict); err != nil { if linter, err := lintChart(path, rvals, l.namespace, l.strict); err != nil {
fmt.Println("==> Skipping", path) fmt.Println("==> Skipping", path)
fmt.Println(err) fmt.Println(err)
if err == errLintNoChart {
rc = 1
}
} else { } else {
fmt.Println("==> Linting", path) fmt.Println("==> Linting", path)
@ -127,6 +131,10 @@ func (l *lintCmd) run() error {
fmt.Fprintf(l.out, "%s, no failures\n", msg) fmt.Fprintf(l.out, "%s, no failures\n", msg)
if rc != 0 {
os.Exit(rc)
}
return nil return nil
} }

@ -28,6 +28,7 @@ var (
archivedChartPathWithHyphens = "testdata/testcharts/compressedchart-with-hyphens-0.1.0.tgz" archivedChartPathWithHyphens = "testdata/testcharts/compressedchart-with-hyphens-0.1.0.tgz"
invalidArchivedChartPath = "testdata/testcharts/invalidcompressedchart0.1.0.tgz" invalidArchivedChartPath = "testdata/testcharts/invalidcompressedchart0.1.0.tgz"
chartDirPath = "testdata/testcharts/decompressedchart/" chartDirPath = "testdata/testcharts/decompressedchart/"
chartMissingManifest = "testdata/testcharts/chart-missing-manifest"
) )
func TestLintChart(t *testing.T) { func TestLintChart(t *testing.T) {
@ -46,4 +47,8 @@ func TestLintChart(t *testing.T) {
if _, err := lintChart(invalidArchivedChartPath, values, namespace, strict); err == nil { if _, err := lintChart(invalidArchivedChartPath, values, namespace, strict); err == nil {
t.Errorf("Expected a chart parsing error") t.Errorf("Expected a chart parsing error")
} }
if _, err := lintChart(chartMissingManifest, values, namespace, strict); err == nil {
t.Errorf("Expected a chart parsing error")
}
} }

Loading…
Cancel
Save