Update .gitea/workflows/lint.yaml
Some checks failed
Check with kubeconform / lint (push) Failing after 5s

This commit is contained in:
ab
2025-04-13 18:45:36 +00:00
parent e1830e67b8
commit 8c781d41cf

View File

@ -14,36 +14,32 @@ jobs:
name: Setup Kubeconform
- name: Validate manifests
id: kubeconform
run: |
invalid_files=$(
find . -name '*.yaml' ! -name '*values.yaml' ! -path './.gitea/*' -print0 |
xargs -0 kubeconform \
-summary \
-output json \
-ignore-missing-schemas \
-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/master/src/schemas/json/kustomization.json' |
jq -r '.resources[] | select(.status == "invalid") | "- \(.filename): \(.msg)"'
)
find . -name '*.yaml' \
! -name '*values.yaml' \
! -path './.gitea/*' -print0 |
xargs -0 kubeconform \
-summary \
-output json \
-ignore-missing-schemas \
-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/master/src/schemas/json/kustomization.json' \
> kubeconform_output.json
if [[ -n "$invalid_files" ]]; then
{
echo 'FAILED=true'
echo "INVALID_FILES<<EOF"
echo "$invalid_files"
echo "EOF"
} >> "$GITHUB_ENV"
echo "::error::Validation failed!"
invalid_count=$(jq '[.resources[] | select(.status=="invalid")] | length' kubeconform_output.json)
if [[ "$invalid_count" -gt 0 ]]; then
jq -r '.resources[] | select(.status=="invalid") | "- \(.filename): \(.msg)"' kubeconform_output.json > invalid_files.txt
cat invalid_files.txt
echo "::error::Validation failed with $invalid_count errors."
exit 1
else
echo "✅ All manifests are valid!"
echo "✅ All manifests valid!"
fi
continue-on-error: true
- name: Notify Telegram on failure
if: env.FAILED == 'true'
if: failure()
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
@ -53,6 +49,6 @@ jobs:
❌ <b>Kubernetes validation failed!</b>
<b>Invalid files:</b>
<pre>${{ env.INVALID_FILES }}</pre>
<pre>${{ join(files('invalid_files.txt'), '\n') }}</pre>
🔗 <a href="https://gt.hexor.cy/${{ github.repository }}/actions/runs/${{ github.run_number }}">Details</a>