From c6549f820406880fcf4d3a62650a0c59e2fc9c9f Mon Sep 17 00:00:00 2001 From: Adrien Bouvais Date: Mon, 17 Aug 2026 09:06:07 +0200 Subject: [PATCH] Added valdiate action --- .gitea/workflows/validate.yaml | 64 ++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 .gitea/workflows/validate.yaml diff --git a/.gitea/workflows/validate.yaml b/.gitea/workflows/validate.yaml new file mode 100644 index 0000000..3865640 --- /dev/null +++ b/.gitea/workflows/validate.yaml @@ -0,0 +1,64 @@ +name: Validate Kubernetes & YAML + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + validate-all: + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Install Validation Tools + run: | + # Install yamllint + sudo apt-get update && sudo apt-get install -y yamllint + + # Install Helm + curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash + + # Install Kubeconform + wget https://github.com/yannh/kubeconform/releases/download/v0.6.4/kubeconform-linux-amd64.tar.gz + tar xf kubeconform-linux-amd64.tar.gz + sudo mv kubeconform /usr/local/bin/ + + - name: Create Yamllint Config + run: | + # We must ignore the Helm templates directory because Go templating {{ }} + # breaks standard YAML parsers. + echo -e "extends: default\nignore: |\n charts/**/templates/\n" > .yamllint.yaml + + - name: Step 1 - Lint Pure YAML Files + run: yamllint . + + - name: Step 2 - Lint Helm Chart Syntax + run: helm lint charts/tenant/ + + - name: Step 3 - Validate Static Manifests & ArgoCD CRDs + run: | + # We use a third-party CRD catalog so kubeconform understands + # ArgoCD's Application and ApplicationSet kinds in your gitops/ folder. + kubeconform -strict -summary \ + -schema-location default \ + -schema-location 'https://raw.githubusercontent.com/datreeio/CRDs-catalog/main/{{.Group}}/{{.ResourceKind}}_{{.ResourceAPIVersion}}.json' \ + minio/ gitops/ + + - name: Step 4 - Validate Tenant Configurations against Chart + run: | + # Loop through each tenant, inject their config into the Helm chart, + # and validate the resulting Kubernetes manifests. + for tenant_dir in tenants/*; do + if [ -d "$tenant_dir" ]; then + tenant_name=$(basename "$tenant_dir") + echo "------------------------------------------------" + echo "Validating rendered output for: $tenant_name" + echo "------------------------------------------------" + + helm template "$tenant_name" charts/tenant/ -f "$tenant_dir/config.yaml" | \ + kubeconform -strict -summary -schema-location default + fi + done