check for multiple resources in each file in kubeconform workflow
All checks were successful
Validate Kubernetes Manifests / kubeconform (pull_request) Successful in 14s
All checks were successful
Validate Kubernetes Manifests / kubeconform (pull_request) Successful in 14s
This commit is contained in:
@@ -63,12 +63,12 @@ jobs:
|
||||
for file in ${ALL_CHANGED_FILES}; do
|
||||
[ -z "$file" ] && continue
|
||||
echo "=== Validating: $file ==="
|
||||
KIND=$(yq -r '.kind // ""' "$file" 2>/dev/null || echo "")
|
||||
|
||||
DOC_COUNT=$(yq eval 'length' <(yq eval-all '.' "$file"))
|
||||
for i in $(seq 0 $((DOC_COUNT - 1))); do
|
||||
KIND=$(yq eval ".[$i].kind // \"\"" <(yq eval-all '.' "$file"))
|
||||
if [[ -n "$KIND" && -n "${SCHEMA_MAP[$KIND]}" ]]; then
|
||||
echo "Found $KIND - 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]}"
|
||||
|
||||
if ! /kubeconform \
|
||||
-schema-location "$SCHEMA_URL" \
|
||||
-cache "$KUBECONFORM_CACHE_DIR" \
|
||||
@@ -77,7 +77,7 @@ jobs:
|
||||
EXIT_CODE=1
|
||||
fi
|
||||
else
|
||||
echo "Validating with default schemas"
|
||||
echo "Validating document $i with default schemas"
|
||||
if ! /kubeconform \
|
||||
-schema-location default \
|
||||
-cache "$KUBECONFORM_CACHE_DIR" \
|
||||
@@ -86,7 +86,7 @@ jobs:
|
||||
EXIT_CODE=1
|
||||
fi
|
||||
fi
|
||||
|
||||
done
|
||||
echo ""
|
||||
done
|
||||
|
||||
|
||||
Reference in New Issue
Block a user