include-system-upgrade-in-kubeconform-validation #203

Closed
aggarwalakshun wants to merge 12 commits from include-system-upgrade-in-kubeconform-validation into main
Showing only changes of commit fa09f39d93 - Show all commits

View File

@@ -63,30 +63,30 @@ jobs:
for file in ${ALL_CHANGED_FILES}; do
[ -z "$file" ] && continue
echo "=== Validating: $file ==="
KIND=$(yq -r '.kind // ""' "$file" 2>/dev/null || echo "")
if [[ -n "$KIND" && -n "${SCHEMA_MAP[$KIND]}" ]]; then
echo "Found $KIND - 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" \
-output json \
"$file"; then
EXIT_CODE=1
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 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" \
-output json \
"$file"; then
EXIT_CODE=1
fi
else
echo "Validating document $i with default schemas"
if ! /kubeconform \
-schema-location default \
-cache "$KUBECONFORM_CACHE_DIR" \
-output json \
"$file"; then
EXIT_CODE=1
fi
fi
else
echo "Validating with default schemas"
if ! /kubeconform \
-schema-location default \
-cache "$KUBECONFORM_CACHE_DIR" \
-output json \
"$file"; then
EXIT_CODE=1
fi
fi
done
echo ""
done