Files
homelab/.gitea/workflows/lint.yaml
ab 410e596506
Some checks failed
Check with kubeconform / lint (push) Failing after 5s
Update .gitea/workflows/lint.yaml
2025-04-13 11:21:55 +00:00

72 lines
2.6 KiB
YAML

name: Check with kubeconform
on:
push:
branches: [ main ]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bmuschko/setup-kubeconform@v1
name: Setup Kubeconform
# This is the step that was missing in your workflow execution
- name: Kubeconform validation
id: kubeconform
run: |
# Create a temporary file to store validation output
VALIDATION_OUTPUT_FILE=$(mktemp)
# Run kubeconform and capture output and exit code
find . -name '*.yaml' \
! -name '*values.yaml' \
! -path './.gitea/*' \
-print0 | xargs -0 kubeconform \
-summary \
-verbose \
-output pretty \
-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/refs/heads/master/src/schemas/json/kustomization.json' > $VALIDATION_OUTPUT_FILE 2>&1 || true
# Save the validation output to a step output
VALIDATION_OUTPUT=$(cat $VALIDATION_OUTPUT_FILE)
echo "VALIDATION_OUTPUT<<EOF" >> $GITHUB_ENV
echo "$VALIDATION_OUTPUT" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
# Check if there were validation errors
if grep -q "Error" $VALIDATION_OUTPUT_FILE; then
echo "VALIDATION_FAILED=true" >> $GITHUB_ENV
echo "::error::Kubernetes manifest validation failed!"
echo "$VALIDATION_OUTPUT"
exit 1
else
echo "All manifests are valid!"
echo "$VALIDATION_OUTPUT"
fi
continue-on-error: true
- name: Telegram notify on validation failure
if: env.VALIDATION_FAILED == 'true'
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
message: |
🚨 Kubernetes manifest validation failed!
Repository: ${{ github.repository }}
Branch: ${{ github.ref_name }}
Commit: ${{ github.sha }}
Validation errors:
```
${{ env.VALIDATION_OUTPUT }}
```
See full details: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}