From 093877c226598b352add492ac32d304f2f27a2bb Mon Sep 17 00:00:00 2001 From: falcorocks <14293929+falcorocks@users.noreply.github.com> Date: Mon, 3 Feb 2025 14:54:09 +0100 Subject: [PATCH] ci: add workflow to validate schema --- .../check-schema-policy-controller.yml | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/check-schema-policy-controller.yml diff --git a/.github/workflows/check-schema-policy-controller.yml b/.github/workflows/check-schema-policy-controller.yml new file mode 100644 index 00000000..30e0252f --- /dev/null +++ b/.github/workflows/check-schema-policy-controller.yml @@ -0,0 +1,41 @@ +name: Check Helm Schema (policy-controller only) + +on: + pull_request: + paths: + - "charts/policy-controller/**" + +jobs: + schema: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: setup go + uses: actions/setup-go@v5 + with: + go-version: '>=1.23.1' + + - name: install helm-schema + run: go install github.com/dadav/helm-schema/cmd/helm-schema@latest + + - name: test helm-schema + run: helm-schema --version + + - name: Run Helm Schema and check the outcome + run: | + cd charts/policy-controller && helm-schema -k additionalProperties,required + exit_code=$(git diff --exit-code) + exit ${exit_code} + + - name: Print a comment in case of failure + run: | + echo "The policy controller values.schema.json is not up to date or has not been produced correctly + + Please, install https://github.com/dadav/helm-schema + And run with flag -k additionalProperties,required before pushing + exit 1 + if: | + failure() && github.event.pull_request.head.repo.full_name == github.repository