diff --git a/scripts/validate.sh b/scripts/validate.sh index b20a22ef7523b0ba6bcee5998d91c1e2ad907c62..009cfa89a54ff4b065af50cda037844ba35d330b 100755 --- a/scripts/validate.sh +++ b/scripts/validate.sh @@ -30,20 +30,20 @@ set -o errexit -KUBERNETES_VERSION=1.21.8 +KUBERNETES_VERSION=1.22.12 echo "INFO - Downloading Flux OpenAPI schemas" mkdir -p /tmp/flux-crd-schemas/master-standalone-strict curl -sL https://github.com/fluxcd/flux2/releases/latest/download/crd-schemas.tar.gz | tar zxf - -C /tmp/flux-crd-schemas/master-standalone-strict -find . -type f -name '*.yaml' -print0 | while IFS= read -r -d $'\0' file; +find . -type f -name '*.yaml' ! -path "./charts/*" -print0 | while IFS= read -r -d $'\0' file; do echo "INFO - Validating $file" yq e 'true' "$file" > /dev/null done echo "INFO - Validating clusters" -find ./clusters -maxdepth 2 -type f -name '*.yaml' -print0 | while IFS= read -r -d $'\0' file; +find ./clusters -maxdepth 2 -type f -name '*.yaml' ! -path "./charts/*" -print0 | while IFS= read -r -d $'\0' file; do kubeval ${file} --strict --ignore-missing-schemas --kubernetes-version ${KUBERNETES_VERSION} --additional-schema-locations=file:///tmp/flux-crd-schemas if [[ ${PIPESTATUS[0]} != 0 ]]; then @@ -56,7 +56,7 @@ kustomize_flags="--load-restrictor=LoadRestrictionsNone --reorder=legacy" kustomize_config="kustomization.yaml" echo "INFO - Validating kustomize overlays" -find . -type f -name $kustomize_config -print0 | while IFS= read -r -d $'\0' file; +find . -type f -name $kustomize_config ! -path "./charts/*" -print0 | while IFS= read -r -d $'\0' file; do echo "INFO - Validating kustomization ${file/%$kustomize_config}" kustomize build "${file/%$kustomize_config}" $kustomize_flags | \