{"id":13740398,"url":"https://github.com/datreeio/helm-datree","last_synced_at":"2025-06-16T20:38:03.545Z","repository":{"id":38362931,"uuid":"367815996","full_name":"datreeio/helm-datree","owner":"datreeio","description":"A Helm plugin to validate charts against the Datree's CLI tool","archived":false,"fork":false,"pushed_at":"2024-06-20T10:49:23.000Z","size":50,"stargazers_count":114,"open_issues_count":2,"forks_count":26,"subscribers_count":12,"default_branch":"main","last_synced_at":"2025-04-12T00:01:47.789Z","etag":null,"topics":["helm","kubernetes"],"latest_commit_sha":null,"homepage":"https://hub.datree.io/integrations","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/datreeio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2021-05-16T07:46:14.000Z","updated_at":"2025-02-28T13:57:14.000Z","dependencies_parsed_at":"2024-01-23T21:47:16.692Z","dependency_job_id":"bc29b8f5-3db0-4328-95c2-a97472d8a55d","html_url":"https://github.com/datreeio/helm-datree","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/datreeio/helm-datree","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datreeio%2Fhelm-datree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datreeio%2Fhelm-datree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datreeio%2Fhelm-datree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datreeio%2Fhelm-datree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/datreeio","download_url":"https://codeload.github.com/datreeio/helm-datree/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datreeio%2Fhelm-datree/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260233987,"owners_count":22978905,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["helm","kubernetes"],"created_at":"2024-08-03T04:00:47.283Z","updated_at":"2025-06-16T20:38:03.523Z","avatar_url":"https://github.com/datreeio.png","language":"Shell","funding_links":[],"categories":["💻 Projects","Shell"],"sub_categories":[],"readme":"# Datree Helm Plugin\n\nA [Helm](https://www.datree.io/helm-chart) plugin to validate charts against the Datree policy  \n\n## Installation\n```\nhelm plugin install https://github.com/datreeio/helm-datree\n```\n⚠️ Helm plugins are not supported on Windows OS ⚠️  \n_Windows users can work around this by using [Helm under WSL](https://github.com/helm/helm-2to3#for-windows-using-wsl)_\n\u003c/br\u003e\n\n### Update Datree's plugin version\n```\nhelm plugin update datree\n```\n### Uninstall\n```\nhelm plugin uninstall datree\n```\n\n## Usage\n\n### Trigger datree policy check via the helm CLI\n```\nhelm datree test [CHART_DIRECTORY]\n```\n\n### Passing arguments\nIf you need to pass helm arguments to your template, you will need to add `--` before them:\n```\nhelm datree test [CHART_DIRECTORY] -- --values values.yaml --set name=prod\n```\n### Test files\nBy default, test files generated by Helm will be skipped. If you wish to include test files in your policy check, add the `--include-tests` flag:\n```\nhelm datree test --include-tests [CHART_DIRECTORY]\n```\n\n### Check plugin version\n```\nhelm datree version\n```\n\n### See help text\n```\nhelm datree help\n```\n\n### Using other helm command\nHelm might be installed through other tooling like microk8s. The `DATREE_HELM_COMMAND` allows specifying a command to run helm (default: `helm`):\n```\nDATREE_HELM_COMMAND=\"microk8s helm3\" helm datree test [CHART_DIRECTORY]\n```\n\n## Testing multiple charts\n\nIf you have multiple charts inside a single directory, you can test all of them sequentially using the following script:\n\n```bash\n#!/bin/bash\n\npath=\"${1:-.}\"\nfinal_exit_code=0\n\nwhile read -r helmchart; do\n\tdir=\"$(dirname \"$helmchart\")\"\n    echo \"*** Proceeding to test Helm chart: $helmchart ***\"\n\tset +e\n\thelm datree test \"$dir\"\n\texitcode=$?\n\tset -e\n\tif [ \"$exitcode\" -gt \"$final_exit_code\" ]; then\n        final_exit_code=\"$exitcode\"\n    fi\n    echo \"\"\ndone \u003c \u003c(find \"$path\" -type f -name 'Chart.y*ml')\n\nif [ \"$final_exit_code\" = 0 ]; then\n    echo \"Success\"\nelse\n    echo \"Violations found, returning exit code $final_exit_code\"\nfi\nexit \"$final_exit_code\"\n```\n\nThe script will run a policy check against all charts before exiting, and return 0 only if no violations were found in any of them.  \nThis is useful for CI, to avoid the need to call `datree test` multiple times.  \n\n## Examples\n\n### Basic usage\n```\nhelm plugin install https://github.com/datreeio/helm-datree\ngit clone git@github.com:datreeio/examples.git\nhelm datree test examples/helm-chart/nginx\n```\n\n![image](https://user-images.githubusercontent.com/19731161/131975552-b66a84f8-5aa9-4d70-a08e-aae97aa76116.png)\n\n### GitHub Workflow\n```yaml\non:\n  push:\n    branches: [ main ]\n  pull_request:\n    branches: [ main ]\n    \nenv:\n  DATREE_TOKEN: ${{ secrets.DATREE_TOKEN }} \n\njobs:\n  k8sPolicyCheck:\n    runs-on: ubuntu-latest\n\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v2\n        \n      - name: Run Datree Policy Check\n        uses: datreeio/action-datree@main\n        with:\n          path: 'myChartDirectory'\n          cliArguments: '--only-k8s-files'\n          isHelmChart: true\n          helmArguments: '--values values.yaml'\n```\n\n## Troubleshooting\n\n### Error: plugin \"datree\" exited with error\nThis is actually expected behavior because it's raised by Helm itself every time a plugin returns a [non-zero exit code](https://www.gnu.org/software/bash/manual/html_node/Exit-Status.html#:~:text=A%20non%2Dzero%20exit%20status,N%20as%20the%20exit%20status.).  \nTherefore, if you will run datree plugin on a Chart that will pass the policy check, it will return 0 as exit code, and you will not see this error.\n\n### K8s schema validation error\nThis error occurs when trying to scan Chart.yaml or values.yaml files instead of the chart directory.  \n**Solution:** Pass the helm chart directory path to Datree's CLI, instead of to the file itself:  \n* Correct - `helm datree test examples/helm-chart/nginx`\n* Wrong - `helm datree test examples/helm-chart/nginx/values.yaml`\n\n### The policy check returns false-positive results\nThe best way to determine if a false-positive result is a bug or a true misconfiguration, is by rendering the Kubernetes manifest with helm and then checking it manually:\n```\nhelm template [CHART_DIRECTORY]\n```\nIf after eyeballing the rendered manifest you still suspect it's a bug, please open an issue. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatreeio%2Fhelm-datree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdatreeio%2Fhelm-datree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatreeio%2Fhelm-datree/lists"}