Skip to content

Commit

Permalink
enhancement(ci): Validate Helm chart in CI (#1957)
Browse files Browse the repository at this point in the history
#### Description

<!-- Thank you for contributing Cerbos! Please describe the changes made
in this PR here and provide any other useful information for reviewers.
Make sure that you included some automated tests (e.g unit tests) to
verify your changes. If there is a requirement for user input for
testing, please include the instructions as well. -->
Adds helm charts validation to the CI.

Fixes #<!-- Link the relevant issue here -->
#1549

#### Checklist 

<!-- See
https://github.com/cerbos/cerbos/blob/main/CONTRIBUTING.md#submitting-pull-requests
for more information. -->

- [x] The PR title has the correct prefix 
- [x] PR is linked to the corresponding issue
- [x] All commits are signed-off (`git commit -s ...`) to provide the
[DCO](https://developercertificate.org/)

---------

Signed-off-by: Piotr Solarczyk <psolarcz@cisco.com>
  • Loading branch information
psolarcz committed Jan 24, 2024
1 parent 4afdc2f commit 5db9ab0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/pr-test.yaml
Expand Up @@ -236,3 +236,19 @@ jobs:
with:
against: https://github.com/cerbos/cerbos.git#tag=${{ steps.latest-release.outputs.tag }}
since: https://github.com/cerbos/cerbos.git#branch=main

test-helm:
needs: changes
if: ${{ needs.changes.outputs.code == 'true' }}
name: Helm test
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v4
with:
go-version: '>=1.21'

- name: Test Helm chart
run: ./deploy/charts/validate.sh
4 changes: 4 additions & 0 deletions deploy/charts/validate.sh
Expand Up @@ -11,6 +11,9 @@ MIN_KUBE_VERSION="1.23.0"
if ! command -v kubeconform &> /dev/null; then
go install github.com/yannh/kubeconform/cmd/kubeconform@latest
fi
if ! command -v pluto &> /dev/null; then
go install github.com/fairwindsops/pluto@latest
fi

for VALUES_FILE in "${CHART_DIR}"/values*; do
echo "Checking $VALUES_FILE"
Expand All @@ -19,6 +22,7 @@ for VALUES_FILE in "${CHART_DIR}"/values*; do
-schema-location default \
-schema-location 'https://raw.githubusercontent.com/datreeio/CRDs-catalog/main/{{.Group}}/{{.ResourceKind}}_{{.ResourceAPIVersion}}.json' \
-summary
helm template cerbos-test "$CHART_DIR" --values="$VALUES_FILE" --kube-version="$MIN_KUBE_VERSION" | pluto detect - --target-version v"$MIN_KUBE_VERSION"
echo " "
done

0 comments on commit 5db9ab0

Please sign in to comment.