yonahd / kor

A Golang Tool to discover unused Kubernetes Resources
MIT License
974 stars 91 forks source link

feat: add helm chart testing #293

Closed found-it closed 4 months ago

found-it commented 4 months ago

Add helm chart testing with https://github.com/helm/chart-testing-action

What this PR does / why we need it?

This PR adds some basic helm chart testing. It lints the chart and spins up a cluster to install the chart with each values file in charts/kor/ci/*-values.yaml.

PR Checklist

GitHub Issue

Should address https://github.com/yonahd/kor/issues/286

Notes for your reviewers

I just took the basic example from https://github.com/helm/chart-testing-action and applied it here. I ran ct install locally to test the chart, it correctly failed without the fixes from https://github.com/yonahd/kor/pull/292 and correctly passed when I applied the fixes.

I just set up default and "with cronjob" values since those are the two documented cases in the README.

I also had to modify the .gitignore because the kor entry was too broad and ended up ignoring things in charts/kor

codecov-commenter commented 4 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 40.96%. Comparing base (5b9c270) to head (ef39576). Report is 2 commits behind head on main.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #293 +/- ## ======================================= Coverage 40.96% 40.96% ======================================= Files 58 58 Lines 2910 2910 ======================================= Hits 1192 1192 Misses 1530 1530 Partials 188 188 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

yonahd commented 4 months ago

Looks like you need to bump the chart version And then regenerate the Readme using docker run --rm --volume "$(pwd):/helm-docs" -u $(id -u) jnorwood/helm-docs:latest

yonahd commented 4 months ago

Looks good. Just regenerate the helm Readme using docker run --rm --volume "$(pwd):/helm-docs" -u $(id -u) jnorwood/helm-docs:latest

found-it commented 4 months ago

@yonahd I added a test to CI to alert when the readme needs to be regenerated. I just want to test and make sure it does the right thing then I will update the readme and add

found-it commented 4 months ago

Awesome, looks like it did the right thing. Updated the readme

yonahd commented 4 months ago

@yonahd I added a test to CI to alert when the readme needs to be regenerated. I just want to test and make sure it does the right thing then I will update the readme and add

Nice! Looks like you also did most of #287