refactor(ci): convert CRD schema generator to uv inline script
This commit is contained in:
@@ -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
|
Extract OpenAPI v3 schemas from CRD YAML on stdin and write JSON schema files
|
||||||
to the output directory for use with kubeconform.
|
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 sys
|
||||||
import json
|
import json
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ total=0
|
|||||||
while IFS= read -r -d "" k; do
|
while IFS= read -r -d "" k; do
|
||||||
dir="$(dirname "$k")"
|
dir="$(dirname "$k")"
|
||||||
n=$(kustomize build --enable-helm "$dir" 2>/dev/null \
|
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))
|
total=$((total + n))
|
||||||
done < <(find apps/overlays clusters -name kustomization.yaml -print0 | sort -z)
|
done < <(find apps/overlays clusters -name kustomization.yaml -print0 | sort -z)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user