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:
@ -13,46 +13,46 @@ jobs:
|
||||
- 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=$(mktemp)
|
||||
VALIDATION_OUTPUT_FILE=$(mktemp)
|
||||
|
||||
# Run kubeconform and capture output
|
||||
# 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 2>&1
|
||||
-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
|
||||
|
||||
# Store exit code
|
||||
VALIDATION_EXIT_CODE=$?
|
||||
|
||||
# Output the content for logs
|
||||
cat $VALIDATION_OUTPUT
|
||||
|
||||
# Store the validation output in a file for the next step
|
||||
# Save the validation output to a step output
|
||||
VALIDATION_OUTPUT=$(cat $VALIDATION_OUTPUT_FILE)
|
||||
echo "VALIDATION_OUTPUT<<EOF" >> $GITHUB_ENV
|
||||
cat $VALIDATION_OUTPUT >> $GITHUB_ENV
|
||||
echo "$VALIDATION_OUTPUT" >> $GITHUB_ENV
|
||||
echo "EOF" >> $GITHUB_ENV
|
||||
|
||||
# Set output variable to indicate validation status
|
||||
echo "status=$VALIDATION_EXIT_CODE" >> $GITHUB_OUTPUT
|
||||
|
||||
# Exit with the same code as kubeconform
|
||||
exit $VALIDATION_EXIT_CODE
|
||||
# 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: steps.kubeconform.outputs.status != '0'
|
||||
if: env.VALIDATION_FAILED == 'true'
|
||||
uses: appleboy/telegram-action@master
|
||||
with:
|
||||
to: ${{ secrets.TELEGRAM_TO }}
|
||||
|
Reference in New Issue
Block a user