Commit f3e75479 authored by Adnan Abdulhussein's avatar Adnan Abdulhussein

fix(lint): print relative path of packaged chart instead of temp dir

parent f273510c
...@@ -82,6 +82,7 @@ func lintCmd(cmd *cobra.Command, args []string) error { ...@@ -82,6 +82,7 @@ func lintCmd(cmd *cobra.Command, args []string) error {
} }
func lintChart(path string) error { func lintChart(path string) error {
var chartPath string
if strings.HasSuffix(path, ".tgz") { if strings.HasSuffix(path, ".tgz") {
tempDir, err := ioutil.TempDir("", "helm-lint") tempDir, err := ioutil.TempDir("", "helm-lint")
if err != nil { if err != nil {
...@@ -100,18 +101,20 @@ func lintChart(path string) error { ...@@ -100,18 +101,20 @@ func lintChart(path string) error {
} }
base := strings.Split(filepath.Base(path), "-")[0] base := strings.Split(filepath.Base(path), "-")[0]
path = filepath.Join(tempDir, base) chartPath = filepath.Join(tempDir, base)
} else {
chartPath = path
} }
// Guard: Error out of this is not a chart. // Guard: Error out of this is not a chart.
if _, err := os.Stat(filepath.Join(path, "Chart.yaml")); err != nil { if _, err := os.Stat(filepath.Join(chartPath, "Chart.yaml")); err != nil {
fmt.Println("==> Skipping", path) fmt.Println("==> Skipping", path)
return errLintNoChart return errLintNoChart
} }
fmt.Println("==> Linting", path) fmt.Println("==> Linting", path)
linter := lint.All(path) linter := lint.All(chartPath)
if len(linter.Messages) == 0 { if len(linter.Messages) == 0 {
fmt.Println("Lint OK") fmt.Println("Lint OK")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment