From 45b76d7c774ea871220f29f8d6d0d259a6ef9044 Mon Sep 17 00:00:00 2001 From: Jonathan Wright Date: Fri, 9 Aug 2024 19:06:04 +0100 Subject: [PATCH] Add linting and validation for Helm Charts Add linting for Helm Charts via helm, and export the Deployment and StatefulSet type deployments and pass through kubeconform to validate the Kubernetes resources are valid for the latest version of kubernetes. --- .github/workflows/integrations.yaml | 47 +++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/.github/workflows/integrations.yaml b/.github/workflows/integrations.yaml index a8d0214..8ba465d 100644 --- a/.github/workflows/integrations.yaml +++ b/.github/workflows/integrations.yaml @@ -85,8 +85,8 @@ jobs: name: go-cover flags: unit-tests - linting: - name: Linting + go-linting: + name: Go Linting runs-on: ubuntu-latest needs: - testing @@ -106,11 +106,52 @@ jobs: with: version: latest + helm-linting: + name: Helm Linting + runs-on: ubuntu-latest + needs: + - testing + steps: + - name: Checkout the repository + uses: actions/checkout@v4 + + - name: Set up Helm + uses: azure/setup-helm@v4.2.0 + + - name: Set up Kubeconform + uses: bmuschko/setup-kubeconform@v1 + with: + kubeconform-version: '0.6.7' + + - name: Lint the Helm Chart + run: |- + # helm lint + helm lint charts/dashboard + + - name: Validate the Deployment + run: |- + # helm lint + helm template -n default dashboard charts/dashboard \ + --set serviceAccount.create=true \ + --set networkPolicy.create=true \ + --set serviceMonitor.create=true \ + | kubeconform -verbose -output pretty -summary + + - name: Validate the StatefulSet + run: |- + # helm lint + helm template -n default dashboard charts/dashboard \ + --set serviceAccount.create=true \ + --set networkPolicy.create=true \ + --set serviceMonitor.create=true \ + --set persistentVolumeClaim.create=true \ + | kubeconform -verbose -output pretty -summary + build: name: Build runs-on: ubuntu-latest needs: - - linting + - go-linting - testing steps: - name: Checkout the repository