forked from ab/homelab
Update .gitea/workflows/lint.yaml
This commit is contained in:
@ -14,12 +14,14 @@ jobs:
|
|||||||
name: Setup Kubeconform
|
name: Setup Kubeconform
|
||||||
|
|
||||||
- name: Validate manifests
|
- name: Validate manifests
|
||||||
|
id: validation
|
||||||
run: |
|
run: |
|
||||||
find . -name '*.yaml' \
|
find . -name '*.yaml' \
|
||||||
! -name '*values.yaml' \
|
! -name '*values.yaml' \
|
||||||
! -path './.gitea/*' -print0 |
|
! -path './.gitea/*' -print0 \
|
||||||
xargs -0 kubeconform \
|
| xargs -0 kubeconform \
|
||||||
-summary \
|
-summary \
|
||||||
|
-verbose \
|
||||||
-output json \
|
-output json \
|
||||||
-ignore-missing-schemas \
|
-ignore-missing-schemas \
|
||||||
-schema-location default \
|
-schema-location default \
|
||||||
@ -30,15 +32,16 @@ jobs:
|
|||||||
invalid_count=$(jq '[.resources[] | select(.status=="invalid")] | length' kubeconform_output.json)
|
invalid_count=$(jq '[.resources[] | select(.status=="invalid")] | length' kubeconform_output.json)
|
||||||
|
|
||||||
if [[ "$invalid_count" -gt 0 ]]; then
|
if [[ "$invalid_count" -gt 0 ]]; then
|
||||||
jq -r '.resources[] | select(.status=="invalid") | "- \(.filename): \(.msg)"' kubeconform_output.json > invalid_files.txt
|
echo "❌ Found $invalid_count invalid manifests:"
|
||||||
cat invalid_files.txt
|
jq -r '.resources[] | select(.status=="invalid") | "- \(.filename): \(.msg)"' kubeconform_output.json \
|
||||||
|
| tee invalid_files.txt
|
||||||
echo "::error::Validation failed with $invalid_count errors."
|
echo "::error::Validation failed with $invalid_count errors."
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo "✅ All manifests valid!"
|
echo "✅ All manifests are valid!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Notify Telegram on failure
|
- name: Send Telegram notification on failure
|
||||||
if: failure()
|
if: failure()
|
||||||
uses: appleboy/telegram-action@master
|
uses: appleboy/telegram-action@master
|
||||||
with:
|
with:
|
||||||
@ -48,7 +51,7 @@ jobs:
|
|||||||
message: |
|
message: |
|
||||||
❌ <b>Kubernetes validation failed!</b>
|
❌ <b>Kubernetes validation failed!</b>
|
||||||
|
|
||||||
<b>Invalid files:</b>
|
📝 <b>Errors:</b>
|
||||||
<pre>${{ join(files('invalid_files.txt'), '\n') }}</pre>
|
<pre>${{ join(files('invalid_files.txt'), '\n') }}</pre>
|
||||||
|
|
||||||
🔗 <a href="https://gt.hexor.cy/${{ github.repository }}/actions/runs/${{ github.run_number }}">Details</a>
|
🔗 <a href="https://gt.hexor.cy/${{ github.repository }}/actions/runs/${{ github.run_number }}">Check details</a>
|
||||||
|
Reference in New Issue
Block a user