feat(ci): add CRD schema generation for kubeconform validation #183

Closed
unkinben wants to merge 2 commits from benvin/kubeconform-crd-schemas into main
2 changed files with 7 additions and 3 deletions
Showing only changes of commit fd7fc8f41b - Show all commits
+6 -2
View File
@@ -1,9 +1,13 @@
#!/usr/bin/env python3
#!/usr/bin/env -S uv run
# /// script
# requires-python = ">=3.11"
# dependencies = ["pyyaml"]
# ///
"""
Extract OpenAPI v3 schemas from CRD YAML on stdin and write JSON schema files
to the output directory for use with kubeconform.
Usage: kustomize build ... | python3 ci/generate-crd-schemas.py <output-dir>
Usage: kustomize build ... | ci/generate-crd-schemas.py <output-dir>
"""
import sys
import json
+1 -1
View File
@@ -16,7 +16,7 @@ total=0
while IFS= read -r -d "" k; do
dir="$(dirname "$k")"
n=$(kustomize build --enable-helm "$dir" 2>/dev/null \
| python3 "$SCRIPT_DIR/generate-crd-schemas.py" "$OUTPUT_DIR") || continue
| "$SCRIPT_DIR/generate-crd-schemas.py" "$OUTPUT_DIR") || continue
total=$((total + n))
done < <(find apps/overlays clusters -name kustomization.yaml -print0 | sort -z)