Skip to content

Instantly share code, notes, and snippets.

@magickatt
Created February 24, 2023 15:00
Show Gist options
  • Save magickatt/ccd1232b85c7626b87a1cf3cae6e23a0 to your computer and use it in GitHub Desktop.
Save magickatt/ccd1232b85c7626b87a1cf3cae6e23a0 to your computer and use it in GitHub Desktop.
GitHub Action to validate Helm charts
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