From 9c405d49c704c17aa728c2c1b2c897d512405a27 Mon Sep 17 00:00:00 2001 From: Cees-Jan Kiewiet Date: Sat, 23 Nov 2024 15:51:03 +0100 Subject: [PATCH] Enforce value files must match schema --- .github/workflows/helm-charts-test.yaml | 52 ++++++++++++++----------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/.github/workflows/helm-charts-test.yaml b/.github/workflows/helm-charts-test.yaml index 127eb9b..2838dc1 100644 --- a/.github/workflows/helm-charts-test.yaml +++ b/.github/workflows/helm-charts-test.yaml @@ -18,33 +18,39 @@ jobs: - name: Lint charts id: lint run: ct lint --all -# collect-values-files-to-validate: -# runs-on: ubuntu-latest -# name: Validate values schema json -# steps: -# - name: Checkout -# uses: actions/checkout@v4 -# - name: Validate values schema json -# uses: losisin/helm-values-schema-json-action@v1 -# with: -# input: values.yaml -# fail-on-diff: true -# validate-values-schema: -# runs-on: ubuntu-latest -# name: Validate values schema json -# steps: -# - name: Checkout -# uses: actions/checkout@v4 -# - name: Validate values schema json -# uses: losisin/helm-values-schema-json-action@v1 -# with: -# input: values.yaml -# fail-on-diff: true + validate-values-schema: + runs-on: ubuntu-latest + name: Validate values schema json + strategy: + matrix: + chart: + - cron-jobs + - default-backend + - docker-hub-exporter + - pi-hole-exporter + - redirect + - redis-db-assignment-operator + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + sparse-checkout: | + charts/${{ matrix.chart }}/ + - name: Get values files + id: value + run: | + printf "files=%s" $(ls -R charts/${{ matrix.chart }}/**/*values.yaml | jq -R -s -c 'split("\n")[:-1]' | jq -r '(.[0] | keys_unsorted) as $keys | $keys, map([.[ $keys[] ]])[] | @csv') >> $GITHUB_OUTPUT + - name: Validate values schema json + uses: losisin/helm-values-schema-json-action@v1 + with: + input: ${{ steps.value.outputs.files }} + output: charts/${{ matrix.chart }}/values.schema.json + fail-on-diff: true test: runs-on: ubuntu-latest needs: - lint -# - validate-values-schema + - validate-values-schema strategy: fail-fast: false matrix: