|
|
|
@ -1,7 +1,10 @@
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"errors"
|
|
|
|
|
"fmt"
|
|
|
|
|
"os"
|
|
|
|
|
"path/filepath"
|
|
|
|
|
|
|
|
|
|
"github.com/kubernetes/helm/pkg/lint"
|
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
@ -20,20 +23,29 @@ var lintCommand = &cobra.Command{
|
|
|
|
|
Use: "lint [flags] PATH",
|
|
|
|
|
Short: "Examines a chart for possible issues",
|
|
|
|
|
Long: longLintHelp,
|
|
|
|
|
Run: lintCmd,
|
|
|
|
|
RunE: lintCmd,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
|
RootCommand.AddCommand(lintCommand)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func lintCmd(cmd *cobra.Command, args []string) {
|
|
|
|
|
var errLintNoChart = errors.New("no chart found for linting (missing Chart.yaml).")
|
|
|
|
|
|
|
|
|
|
func lintCmd(cmd *cobra.Command, args []string) error {
|
|
|
|
|
path := "."
|
|
|
|
|
if len(args) > 0 {
|
|
|
|
|
path = args[0]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Guard: Error out of this is not a chart.
|
|
|
|
|
if _, err := os.Stat(filepath.Join(path, "Chart.yaml")); err != nil {
|
|
|
|
|
return errLintNoChart
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
issues := lint.All(path)
|
|
|
|
|
for _, i := range issues {
|
|
|
|
|
fmt.Printf("%s\n", i)
|
|
|
|
|
}
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|