Skip to content

Instantly share code, notes, and snippets.

@magickatt
Created February 24, 2023 15:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save magickatt/36371466d24a4d90743239de721a52e4 to your computer and use it in GitHub Desktop.
Save magickatt/36371466d24a4d90743239de721a52e4 to your computer and use it in GitHub Desktop.
GitHub Action to validate multiple Helm charts at once
name: Validate Helm charts
on:
push:
branches: [ main, master ]
pull_request:
jobs:
validate:
runs-on: ubuntu-latest
strategy:
matrix:
directory:
- "charts/my_application_1"
- "charts/my_application_2"
- "charts/my_application_3"
steps:
- uses: actions/checkout@v3
- name: Check if the Helm chart has changed
uses: dorny/paths-filter@v2
id: filter
with:
filters: |
chart:
- '${{ matrix.directory }}/**'
- name: Copy environment-specific values for linting
if: steps.filter.outputs.chart == 'true'
run: mkdir ${{ matrix.directory }}/ci; cd ${{ matrix.directory }}/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 \
--validate-maintainers=false \
--charts ${{ matrix.directory }} \
--chart-repos datadog=https://helm.datadoghq.com \
--chart-repos goldilocks=https://charts.fairwinds.com/stable \
--chart-repos ambassador=https://app.getambassador.io \
--chart-repos lacework-agent=https://lacework.github.io/helm-charts \
--chart-repos kube-state-metrics=https://prometheus-community.github.io/helm-charts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment