Created
February 24, 2023 15:00
-
-
Save magickatt/ccd1232b85c7626b87a1cf3cae6e23a0 to your computer and use it in GitHub Desktop.
GitHub Action to validate Helm charts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Validate Helm chart | |
on: | |
push: | |
branches: [ main, master ] | |
pull_request: | |
jobs: | |
validate: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Check if the Helm chart has changed | |
uses: dorny/paths-filter@v2 | |
id: filter | |
with: | |
filters: | | |
chart: | |
- 'chart/**' | |
templates: | |
- 'chart/templates/*' | |
- name: Copy environment-specific values for linting | |
if: steps.filter.outputs.chart == 'true' | |
run: cd chart/values; for i in *.yaml; do cp -v "${i}" "../ci/${i%.*}-values.${i##*.}"; done | |
- name: Set up chart-testing | |
if: steps.filter.outputs.chart == 'true' | |
uses: helm/[email protected] | |
- name: Lint Helm chart with chart-testing | |
if: steps.filter.outputs.chart == 'true' | |
run: ct lint --charts k8s | |
- name: Scan Helm chart with kube-linter | |
if: steps.filter.outputs.templates == 'true' | |
uses: stackrox/[email protected] | |
id: kube-linter-action-scan | |
with: | |
directory: k8s | |
config: .kube-linter/config.yaml | |
format: plain |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment