From ee9c24333de024de71502cbe9e613b2b3cdda62f Mon Sep 17 00:00:00 2001 From: Thibault Martin Date: Tue, 26 May 2026 08:22:10 +0200 Subject: [PATCH] test(helm): lint helm charts with ct (#1403) --- .github/workflows/ci-validate.yml | 21 +++++++++++++++++++ deploy/helm/ct.yaml | 5 +++++ deploy/helm/grimmory/.helmignore | 2 ++ deploy/helm/grimmory/ci/default-values.yaml | 1 + .../grimmory/ci/existing-claim-values.yaml | 8 +++++++ .../ci/external-database-secret-values.yaml | 17 +++++++++++++++ .../grimmory/ci/external-database-values.yaml | 12 +++++++++++ deploy/helm/grimmory/ci/ingress-values.yaml | 13 ++++++++++++ .../grimmory/ci/no-persistence-values.yaml | 8 +++++++ 9 files changed, 87 insertions(+) create mode 100644 deploy/helm/ct.yaml create mode 100644 deploy/helm/grimmory/.helmignore create mode 100644 deploy/helm/grimmory/ci/default-values.yaml create mode 100644 deploy/helm/grimmory/ci/existing-claim-values.yaml create mode 100644 deploy/helm/grimmory/ci/external-database-secret-values.yaml create mode 100644 deploy/helm/grimmory/ci/external-database-values.yaml create mode 100644 deploy/helm/grimmory/ci/ingress-values.yaml create mode 100644 deploy/helm/grimmory/ci/no-persistence-values.yaml diff --git a/.github/workflows/ci-validate.yml b/.github/workflows/ci-validate.yml index 9a25b7e8b..1a70755d1 100644 --- a/.github/workflows/ci-validate.yml +++ b/.github/workflows/ci-validate.yml @@ -26,6 +26,27 @@ jobs: path: ${{ github.event_path }} retention-days: 7 + chart-validation: + name: Helm Chart Validation + if: ${{ github.event_name != 'push' || !contains(github.event.head_commit.message, '[skip ci]') }} + runs-on: ubuntu-latest + + permissions: + contents: read + + steps: + - name: Checkout Repository + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + + - name: Install Helm + uses: azure/setup-helm@dda3372f752e03dde6b3237bc9431cdc2f7a02a2 # v5.0.0 + + - name: Install chart-testing + uses: helm/chart-testing-action@6ec842c01de15ebb84c8627d2744a0c2f2755c9f # v2.8.0 + + - name: Run ct lint + run: ct lint --config deploy/helm/ct.yaml + migration-check: name: Flyway Migration Check if: ${{ github.event_name != 'push' || !contains(github.event.head_commit.message, '[skip ci]') }} diff --git a/deploy/helm/ct.yaml b/deploy/helm/ct.yaml new file mode 100644 index 000000000..6fa4679fe --- /dev/null +++ b/deploy/helm/ct.yaml @@ -0,0 +1,5 @@ +target-branch: develop +chart-dirs: + - deploy/helm +all: true +validate-maintainers: false diff --git a/deploy/helm/grimmory/.helmignore b/deploy/helm/grimmory/.helmignore new file mode 100644 index 000000000..1f309968d --- /dev/null +++ b/deploy/helm/grimmory/.helmignore @@ -0,0 +1,2 @@ +# Exclude CI tests +ci/ diff --git a/deploy/helm/grimmory/ci/default-values.yaml b/deploy/helm/grimmory/ci/default-values.yaml new file mode 100644 index 000000000..e0704d074 --- /dev/null +++ b/deploy/helm/grimmory/ci/default-values.yaml @@ -0,0 +1 @@ +# Default chart path diff --git a/deploy/helm/grimmory/ci/existing-claim-values.yaml b/deploy/helm/grimmory/ci/existing-claim-values.yaml new file mode 100644 index 000000000..cb6d433c2 --- /dev/null +++ b/deploy/helm/grimmory/ci/existing-claim-values.yaml @@ -0,0 +1,8 @@ +# Pre-existing PVC claims +# Database: bundled MariaDB +# Persistence: both volumes use existingClaim, PVC templates suppressed +persistence: + dataVolume: + existingClaim: my-existing-data-claim + booksVolume: + existingClaim: my-existing-books-claim diff --git a/deploy/helm/grimmory/ci/external-database-secret-values.yaml b/deploy/helm/grimmory/ci/external-database-secret-values.yaml new file mode 100644 index 000000000..bd4718380 --- /dev/null +++ b/deploy/helm/grimmory/ci/external-database-secret-values.yaml @@ -0,0 +1,17 @@ +# External database with credentials from an existing Kubernetes secret. +# Database: external, all connection values come from secretKeyRef +# Persistence: both PVCs enabled, created by chart +mariadb: + enabled: false +externalDatabase: + enabled: true + host: "" + password: "" + existingSecret: + enabled: true + secretName: db-credentials + hostnameKey: db-host + portKey: db-port + usernameKey: db-user + passwordKey: db-pass + databaseKey: db-name diff --git a/deploy/helm/grimmory/ci/external-database-values.yaml b/deploy/helm/grimmory/ci/external-database-values.yaml new file mode 100644 index 000000000..e0e286e0a --- /dev/null +++ b/deploy/helm/grimmory/ci/external-database-values.yaml @@ -0,0 +1,12 @@ +# External database with plain-text credentials. +# Database: external credentials in env vars +# Persistence: both PVCs enabled, created by chart +mariadb: + enabled: false +externalDatabase: + enabled: true + host: my-cluster + port: 3306 + username: app_user + password: my-password + database: grimmory diff --git a/deploy/helm/grimmory/ci/ingress-values.yaml b/deploy/helm/grimmory/ci/ingress-values.yaml new file mode 100644 index 000000000..5a1d7a3ca --- /dev/null +++ b/deploy/helm/grimmory/ci/ingress-values.yaml @@ -0,0 +1,13 @@ +# Ingress enabled on top of the default configuration. +# Database: bundled MariaDB +# Persistence: both PVCs enabled, created by chart +ingress: + enabled: true + className: nginx + annotations: + cert-manager.io/cluster-issuer: letsencrypt-prod + hosts: + - host: grimmory.example.com + paths: + - path: / + pathType: Prefix diff --git a/deploy/helm/grimmory/ci/no-persistence-values.yaml b/deploy/helm/grimmory/ci/no-persistence-values.yaml new file mode 100644 index 000000000..73504d233 --- /dev/null +++ b/deploy/helm/grimmory/ci/no-persistence-values.yaml @@ -0,0 +1,8 @@ +# No persistent volumes — all storage disabled. +# Database: bundled MariaDB +# Persistence: both PVCs disabled +persistence: + dataVolume: + enabled: false + booksVolume: + enabled: false