Update .gitea/workflows/lint.yaml
All checks were successful
Check with kubeconform / lint (push) Successful in 10s

This commit is contained in:
ab
2025-07-15 11:31:42 +00:00
parent 28e06770c6
commit 1212dfcaec

View File

@@ -1,9 +1,7 @@
name: Check with kubeconform
on:
push:
branches: [ main ]
jobs:
lint:
runs-on: ubuntu-latest
@@ -16,15 +14,43 @@ jobs:
- name: Kubeconform validation
id: kubeconform
run: |
# Create exclusion list - add files that should be skipped from validation
EXCLUSIONS=(
"./k8s/core/system-upgrade/crd.yaml"
# Add more files here as needed
# "./path/to/another/file.yaml"
)
# Create a temporary file for storing validation output
VALIDATION_OUTPUT=$(mktemp)
# Run kubeconform and capture output
find . -name '*.yaml' \
# Function to check if file is in exclusions
is_excluded() {
local file="$1"
for exclusion in "${EXCLUSIONS[@]}"; do
if [[ "$file" == "$exclusion" ]]; then
return 0
fi
done
return 1
}
# Find all yaml files and filter out exclusions
YAML_FILES=()
while IFS= read -r -d '' file; do
if ! is_excluded "$file"; then
YAML_FILES+=("$file")
else
echo "⚠️ Skipping excluded file: $file"
fi
done < <(find . -name '*.yaml' \
! -name '*values.yaml' \
! -path './.gitea/*' \
-print0 \
| xargs -0 kubeconform \
-print0)
# Run kubeconform only if there are files to validate
if [ ${#YAML_FILES[@]} -gt 0 ]; then
printf '%s\0' "${YAML_FILES[@]}" | xargs -0 kubeconform \
-summary \
-verbose \
-output pretty \
@@ -32,6 +58,9 @@ jobs:
-schema-location default \
-schema-location 'https://raw.githubusercontent.com/datreeio/CRDs-catalog/main/{{.Group}}/{{.ResourceKind}}_{{.ResourceAPIVersion}}.json' \
-schema-location 'https://raw.githubusercontent.com/SchemaStore/schemastore/refs/heads/master/src/schemas/json/kustomization.json' > $VALIDATION_OUTPUT 2>&1 || true
else
echo "No files to validate after applying exclusions" > $VALIDATION_OUTPUT
fi
# Display output in logs
cat $VALIDATION_OUTPUT
@@ -44,7 +73,7 @@ jobs:
cat invalid_files.txt
exit 1
else
echo "All manifests are valid!"
echo "All manifests are valid!"
fi
continue-on-error: true