add push trigger for kubeconform workflow
All checks were successful
Validate Kubernetes Manifests / kubeconform (push) Successful in 25s
All checks were successful
Validate Kubernetes Manifests / kubeconform (push) Successful in 25s
This commit is contained in:
@@ -3,6 +3,8 @@ name: Validate Kubernetes Manifests
|
|||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
kubeconform:
|
kubeconform:
|
||||||
@@ -51,27 +53,27 @@ jobs:
|
|||||||
# Create cache directory
|
# Create cache directory
|
||||||
export KUBECONFORM_CACHE_DIR="/tmp/kubeconform-cache"
|
export KUBECONFORM_CACHE_DIR="/tmp/kubeconform-cache"
|
||||||
mkdir -p "$KUBECONFORM_CACHE_DIR"
|
mkdir -p "$KUBECONFORM_CACHE_DIR"
|
||||||
|
|
||||||
# Exit code tracking
|
# Exit code tracking
|
||||||
EXIT_CODE=0
|
EXIT_CODE=0
|
||||||
|
|
||||||
# Process all YAML files
|
# Process all YAML files
|
||||||
while IFS= read -r file; do
|
while IFS= read -r file; do
|
||||||
echo "=== Validating: $file ==="
|
echo "=== Validating: $file ==="
|
||||||
|
|
||||||
# Skip excluded paths
|
# Skip excluded paths
|
||||||
if [[ "$file" == *".gitea/"* ]] || [[ "$file" == *"clusters/default/system-upgrade/"* ]]; then
|
if [[ "$file" == *".gitea/"* ]] || [[ "$file" == *"clusters/default/system-upgrade/"* ]]; then
|
||||||
echo "Skipping excluded file"
|
echo "Skipping excluded file"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Detect resource kind
|
# Detect resource kind
|
||||||
KIND=$(yq -r '.kind // ""' "$file" 2>/dev/null || echo "")
|
KIND=$(yq -r '.kind // ""' "$file" 2>/dev/null || echo "")
|
||||||
|
|
||||||
if [[ -n "$KIND" && -n "${SCHEMA_MAP[$KIND]}" ]]; then
|
if [[ -n "$KIND" && -n "${SCHEMA_MAP[$KIND]}" ]]; then
|
||||||
echo "Found $KIND - using custom schema"
|
echo "Found $KIND - 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]}"
|
||||||
|
|
||||||
if ! /kubeconform \
|
if ! /kubeconform \
|
||||||
-schema-location "$SCHEMA_URL" \
|
-schema-location "$SCHEMA_URL" \
|
||||||
-cache "$KUBECONFORM_CACHE_DIR" \
|
-cache "$KUBECONFORM_CACHE_DIR" \
|
||||||
@@ -89,8 +91,8 @@ jobs:
|
|||||||
EXIT_CODE=1
|
EXIT_CODE=1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
done < <(find . -type f \( -name "*.yml" \) -print)
|
done < <(find . -type f \( -name "*.yml" \) -print)
|
||||||
|
|
||||||
exit $EXIT_CODE
|
exit $EXIT_CODE
|
||||||
|
|||||||
Reference in New Issue
Block a user