44 lines
1.4 KiB
YAML
44 lines
1.4 KiB
YAML
name: Validate Kubernetes & YAML
|
|
|
|
on:
|
|
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: Lint Pure YAML Files
|
|
run: yamllint ./tenants
|
|
|
|
- name: Validate Tenant Configurations against Chart
|
|
run: |
|
|
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
|