Skip to content

Instantly share code, notes, and snippets.

@magickatt
Created February 24, 2023 15:00
Embed
What would you like to do?
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/chart-testing-action@v2.3.1
- 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/kube-linter-action@v1.0.4
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