From 6e3bc233e47bfff0353a8b78a3f5350ef6fa4d18 Mon Sep 17 00:00:00 2001 From: Andreas Beuge Date: Thu, 5 Nov 2026 12:29:50 +0100 Subject: [PATCH 1/2] feat: add reusable Helm lint and render workflow --- .github/workflows/helm.yaml | 51 +++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/helm.yaml diff --git a/.github/workflows/helm.yaml b/.github/workflows/helm.yaml new file mode 100644 index 0000000..0ea903e --- /dev/null +++ b/.github/workflows/helm.yaml @@ -0,0 +1,51 @@ +name: Reusable Helm +on: + workflow_call: + inputs: + runner: + required: false + description: Runner type + default: ubuntu-latest + type: string + timeoutMinutes: + required: false + description: Maximum minutes before the job is cancelled + default: 40 + type: number + chartsPath: + required: false + description: Directory searched for charts (every directory with a Chart.yaml) + default: .chart + type: string +jobs: + helm: + runs-on: ${{ inputs.runner }} + timeout-minutes: ${{ inputs.timeoutMinutes }} + steps: + - name: Checkout current git repository + uses: actions/checkout@v7 + + - name: Set up Helm + uses: azure/setup-helm@v5 + + - name: Lint and render charts + env: + CHARTS_PATH: ${{ inputs.chartsPath }} + run: | + set -euo pipefail + # Skip subcharts that `helm dependency build` vendors into /charts/. + charts=$(find "$CHARTS_PATH" -name Chart.yaml -not -path "$CHARTS_PATH/*/charts/*" -exec dirname {} \; | sort) + if [ -z "$charts" ]; then + echo "::error::No Chart.yaml found under $CHARTS_PATH" + exit 1 + fi + while IFS= read -r chart; do + echo "::group::$chart" + helm dependency build "$chart" + helm lint "$chart" + # Library charts render nothing and make `helm template` fail. + if ! helm show chart "$chart" | grep -q "^type: library"; then + helm template "$chart" > /dev/null + fi + echo "::endgroup::" + done <<< "$charts" From 4fb1dd1e57c8b77385df01085633804ae06b7d1e Mon Sep 17 00:00:00 2001 From: Andreas Beuge Date: Thu, 5 Nov 2026 14:15:52 +0100 Subject: [PATCH 2/2] fix: skip only charts vendored into a chart's charts/ directory --- .github/workflows/helm.yaml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/helm.yaml b/.github/workflows/helm.yaml index 0ea903e..8e3084b 100644 --- a/.github/workflows/helm.yaml +++ b/.github/workflows/helm.yaml @@ -33,13 +33,21 @@ jobs: CHARTS_PATH: ${{ inputs.chartsPath }} run: | set -euo pipefail - # Skip subcharts that `helm dependency build` vendors into /charts/. - charts=$(find "$CHARTS_PATH" -name Chart.yaml -not -path "$CHARTS_PATH/*/charts/*" -exec dirname {} \; | sort) - if [ -z "$charts" ]; then + charts=() + while IFS= read -r chart; do + parent=$(dirname "$chart") + # A chart in /charts/ is a vendored dependency. It is validated + # through its parent, which supplies its values. + if [ "$(basename "$parent")" = charts ] && [ -f "$(dirname "$parent")/Chart.yaml" ]; then + continue + fi + charts+=("$chart") + done < <(find "$CHARTS_PATH" -name Chart.yaml -exec dirname {} \; | sort) + if [ ${#charts[@]} -eq 0 ]; then echo "::error::No Chart.yaml found under $CHARTS_PATH" exit 1 fi - while IFS= read -r chart; do + for chart in "${charts[@]}"; do echo "::group::$chart" helm dependency build "$chart" helm lint "$chart" @@ -48,4 +56,4 @@ jobs: helm template "$chart" > /dev/null fi echo "::endgroup::" - done <<< "$charts" + done