Created
February 24, 2023 15:06
-
-
Save magickatt/36371466d24a4d90743239de721a52e4 to your computer and use it in GitHub Desktop.
GitHub Action to validate multiple Helm charts at once
This file contains 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 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/[email protected] | |
- 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