Closed james03160927 closed 1 month ago
Fixes https://github.com/gruntwork-io/pre-commit/issues/115
.pre-commit-config.yaml local setup
.pre-commit-config.yaml
repos: - repo: local hooks: - id: helmlint name: helmlint (helm chart) args: ["--kube-version", "1.29.4"] entry: ./helmlint.sh language: script pass_filenames: true
test result with debug mode = on. Expected: failed due invalid yaml
$ git add . && git commit --amend --no-edit helmlint (helm chart)....................................................Failed - hook id: helmlint - exit code: 1 Passed args: --kube-version 1.29.4 Checking .pre-commit-config.yaml Checking directory /home/wahyudibo/Workspace/Upwork/DevOn/examples/.pre-commit-config.yaml and /home/wahyudibo/Workspace/Upwork/DevOn/examples for Chart.yaml Checking directory /home/wahyudibo/Workspace/Upwork/DevOn/examples and /home/wahyudibo/Workspace/Upwork/DevOn for Chart.yaml No chart path found Resolved .pre-commit-config.yaml to chart path Checking charts/hello-world/values.yaml Checking directory /home/wahyudibo/Workspace/Upwork/DevOn/examples/charts/hello-world/values.yaml and /home/wahyudibo/Workspace/Upwork/DevOn/examples/charts/hello-world for Chart.yaml Chart path found: /home/wahyudibo/Workspace/Upwork/DevOn/examples/charts/hello-world Resolved charts/hello-world/values.yaml to chart path /home/wahyudibo/Workspace/Upwork/DevOn/examples/charts/hello-world ==> Linting /home/wahyudibo/Workspace/Upwork/DevOn/examples/charts/hello-world [INFO] Chart.yaml: icon is recommended [ERROR] values.yaml: unable to parse YAML: error converting YAML to JSON: yaml: line 26: did not find expected key [ERROR] templates/: cannot load values.yaml: error converting YAML to JSON: yaml: line 26: did not find expected key [ERROR] : unable to load chart cannot load values.yaml: error converting YAML to JSON: yaml: line 26: did not find expected key Error: 1 chart(s) linted, 1 chart(s) failed
test result with debug mode = on. Expected: success
$ git add . && git commit --amend --no-edit helmlint (helm chart)....................................................Passed
test result with debug mode = on. Expected: failed due to missing kube-version value
$ git add . && git commit --amend --no-edit helmlint (helm chart)....................................................Failed - hook id: helmlint - exit code: 1 Error: invalid kube version '.pre-commit-config.yaml': Invalid Semantic Version
Fixes https://github.com/gruntwork-io/pre-commit/issues/115
.pre-commit-config.yaml
local setuptest result with debug mode = on. Expected: failed due invalid yaml
test result with debug mode = on. Expected: success
test result with debug mode = on. Expected: failed due to missing kube-version value