fix: improve document counting in kubeconform validation
Some checks failed
Validate Kubernetes Manifests / kubeconform (pull_request) Has been cancelled

This commit is contained in:
2025-12-12 17:31:36 +05:30
parent fa09f39d93
commit 1366c0780a

View File

@@ -63,9 +63,9 @@ jobs:
for file in ${ALL_CHANGED_FILES}; do for file in ${ALL_CHANGED_FILES}; do
[ -z "$file" ] && continue [ -z "$file" ] && continue
echo "=== Validating: $file ===" echo "=== Validating: $file ==="
DOC_COUNT=$(yq eval 'length' <(yq eval-all '.' "$file")) DOCS=$(yq eval-all '...' "$file" | wc -l)
for i in $(seq 0 $((DOC_COUNT - 1))); do for i in $(seq 0 $((DOCS - 1))); do
KIND=$(yq eval ".[$i].kind // \"\"" <(yq eval-all '.' "$file")) KIND=$(yq eval-all ".[$i].kind // \"\"" "$file")
if [[ -n "$KIND" && -n "${SCHEMA_MAP[$KIND]}" ]]; then if [[ -n "$KIND" && -n "${SCHEMA_MAP[$KIND]}" ]]; then
echo "Found $KIND in document $i - using custom schema" echo "Found $KIND in document $i - using custom schema"
SCHEMA_URL="https://raw.githubusercontent.com/datreeio/CRDs-catalog/refs/heads/main/${SCHEMA_MAP[$KIND]}" SCHEMA_URL="https://raw.githubusercontent.com/datreeio/CRDs-catalog/refs/heads/main/${SCHEMA_MAP[$KIND]}"