datreeio / helm-datree

A Helm plugin to validate charts against the Datree's CLI tool
https://hub.datree.io/integrations
MIT License
113 stars 26 forks source link

Does not work with Helm 3.6.2 #10

Closed matthewbarreiro closed 3 years ago

matthewbarreiro commented 3 years ago

Describe the bug Plugin crashes with helm v3.6.2

To Reproduce

$ helm datree test . --values my-values.yaml
Error: plugin "datree" exited with error

Expected behavior Datree should analyze the Helm template.

Desktop:

Datree plugin version (run helm datree verion):

Additional context

$ helm version
version.BuildInfo{Version:"v3.6.2", GitCommit:"ee407bdf364942bcb8e8c665f82e15aa28009b71", GitTreeState:"dirty", GoVersion:"go1.16.5"}

$ sw_vers  
ProductName:    Mac OS X
ProductVersion: 10.15.7
BuildVersion:   19H1217

$zsh --version
zsh 5.7.1 (x86_64-apple-darwin19.0)
dimabru commented 3 years ago

Hi @matthewbarreiro, Please note that in order to use helm flags you need to add --.

Try the following: helm datree test . -- --values my-values.yaml

Any flag used before adding -- will be sent directly into datree plugin, which is probably why you're getting the error. You can view the usage in our docs: https://hub.datree.io/helm-plugin

matthewbarreiro commented 3 years ago

yes, sorry for the typo. That being said, I am still getting errors no matter how I try to invoke the helm plugin:

Exactly as shown in your docs:

➜  ~ git clone git@github.com:datreeio/examples.git
➜  ~ helm datree test examples/helm-chart/nginx

No files detected
Error: plugin "datree" exited with error

If I cd in and use . I get:

➜  ~ cd examples/helm-chart/nginx
➜  nginx git:(main) helm datree test .

No files detected
Error: plugin "datree" exited with error

If I select a specific file:

➜  nginx git:(main) helm datree test Chart.yaml
>>  File: /Users/matt/examples/helm-chart/nginx/Chart.yaml

[V] YAML validation
[X] Kubernetes schema validation

❌  k8s schema validation error: error while parsing: missing 'kind' key

[?] Policy check didn’t run for this file

(Summary)

- Passing YAML validation: 1/1

- Passing Kubernetes (1.20.7) schema validation: 0/1

- Passing policy check: 0/1

+-----------------------------------+----------------------------------------------------------+
| Enabled rules in policy “Default” | 30                                                       |
| Configs tested against policy     | 0                                                        |
| Total rules evaluated             | 0                                                        |
| Total rules failed                | 0                                                        |
| Total rules passed                | 0                                                        |
| See all rules in policy           | REMOVED
+-----------------------------------+----------------------------------------------------------+

Error: plugin "datree" exited with error

Note how it did not evaluate any rules. It also didn't display any issues, and I assume the example helm chart has intentional issues that are not being detected here for some reason.

Thanks

eyarz commented 3 years ago

@dimabru also happening to me when I use the latest version of the plugin. an older version is working fine.

dimabru commented 3 years ago

@matthewbarreiro A fix is already in the works, thanks for reporting.

Just an fyi, helm is expecting a chart folder as input and not the Chart.yaml itself. Running helm datree test Chart.yaml will result in datree trying to evaluate the Chart.yaml file without helm rendering it, so the output here is valid because it was indeed not a valid k8s file :)