Update .gitea/workflows/lint.yaml
Some checks failed
Check with kubeconform / lint (push) Failing after 5s
Some checks failed
Check with kubeconform / lint (push) Failing after 5s
This commit is contained in:
@ -14,36 +14,32 @@ jobs:
|
|||||||
name: Setup Kubeconform
|
name: Setup Kubeconform
|
||||||
|
|
||||||
- name: Validate manifests
|
- name: Validate manifests
|
||||||
id: kubeconform
|
|
||||||
run: |
|
run: |
|
||||||
invalid_files=$(
|
find . -name '*.yaml' \
|
||||||
find . -name '*.yaml' ! -name '*values.yaml' ! -path './.gitea/*' -print0 |
|
! -name '*values.yaml' \
|
||||||
xargs -0 kubeconform \
|
! -path './.gitea/*' -print0 |
|
||||||
-summary \
|
xargs -0 kubeconform \
|
||||||
-output json \
|
-summary \
|
||||||
-ignore-missing-schemas \
|
-output json \
|
||||||
-schema-location default \
|
-ignore-missing-schemas \
|
||||||
-schema-location 'https://raw.githubusercontent.com/datreeio/CRDs-catalog/main/{{.Group}}/{{.ResourceKind}}_{{.ResourceAPIVersion}}.json' \
|
-schema-location default \
|
||||||
-schema-location 'https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/kustomization.json' |
|
-schema-location 'https://raw.githubusercontent.com/datreeio/CRDs-catalog/main/{{.Group}}/{{.ResourceKind}}_{{.ResourceAPIVersion}}.json' \
|
||||||
jq -r '.resources[] | select(.status == "invalid") | "- \(.filename): \(.msg)"'
|
-schema-location 'https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/kustomization.json' \
|
||||||
)
|
> kubeconform_output.json
|
||||||
|
|
||||||
if [[ -n "$invalid_files" ]]; then
|
invalid_count=$(jq '[.resources[] | select(.status=="invalid")] | length' kubeconform_output.json)
|
||||||
{
|
|
||||||
echo 'FAILED=true'
|
if [[ "$invalid_count" -gt 0 ]]; then
|
||||||
echo "INVALID_FILES<<EOF"
|
jq -r '.resources[] | select(.status=="invalid") | "- \(.filename): \(.msg)"' kubeconform_output.json > invalid_files.txt
|
||||||
echo "$invalid_files"
|
cat invalid_files.txt
|
||||||
echo "EOF"
|
echo "::error::Validation failed with $invalid_count errors."
|
||||||
} >> "$GITHUB_ENV"
|
|
||||||
echo "::error::Validation failed!"
|
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo "✅ All manifests are valid!"
|
echo "✅ All manifests valid!"
|
||||||
fi
|
fi
|
||||||
continue-on-error: true
|
|
||||||
|
|
||||||
- name: Notify Telegram on failure
|
- name: Notify Telegram on failure
|
||||||
if: env.FAILED == 'true'
|
if: failure()
|
||||||
uses: appleboy/telegram-action@master
|
uses: appleboy/telegram-action@master
|
||||||
with:
|
with:
|
||||||
to: ${{ secrets.TELEGRAM_TO }}
|
to: ${{ secrets.TELEGRAM_TO }}
|
||||||
@ -53,6 +49,6 @@ jobs:
|
|||||||
❌ <b>Kubernetes validation failed!</b>
|
❌ <b>Kubernetes validation failed!</b>
|
||||||
|
|
||||||
<b>Invalid files:</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>
|
🔗 <a href="https://gt.hexor.cy/${{ github.repository }}/actions/runs/${{ github.run_number }}">Details</a>
|
||||||
|
Reference in New Issue
Block a user