Releases.mondoo.com File Validation #85
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Releases.mondoo.com File Validation | |
on: | |
schedule: | |
- cron: '*/15 * * * *' # Run every 15 minutes | |
workflow_dispatch: # Allow manual triggers | |
jobs: | |
validate: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install requests | |
- name: Validate Mondoo releases | |
id: mondoo | |
continue-on-error: true | |
run: | | |
python test/releases/validate_release.py mondoo && echo "mondoo_status=$?" >> $GITHUB_ENV || echo "mondoo_status=$?" >> $GITHUB_ENV | |
- name: Validate cnquery releases | |
id: cnquery | |
continue-on-error: true | |
run: | | |
python test/releases/validate_release.py cnquery && echo "cnquery_status=$?" >> $GITHUB_ENV || echo "cnquery_status=$?" >> $GITHUB_ENV | |
- name: Validate cnspec releases | |
id: cnspec | |
continue-on-error: true | |
run: | | |
python test/releases/validate_release.py cnspec && echo "cnspec_status=$?" >> $GITHUB_ENV || echo "cnspec_status=$?" >> $GITHUB_ENV | |
- name: Send Slack notification on failure | |
if: env.mondoo_status != '0' || env.cnquery_status != '0' || env.cnspec_status != '0' | |
uses: slackapi/[email protected] | |
with: | |
method: chat.postMessage | |
token: ${{ secrets.SLACK_BOT_TOKEN }} | |
payload: | | |
{ | |
"channel": "C07QZDJFF89", | |
"text": "⚠️ Release File Validation Failures Detected", | |
"blocks": [ | |
{ | |
"type": "header", | |
"text": { | |
"type": "plain_text", | |
"text": "⚠️ Release File Validation Failures" | |
} | |
}, | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "*Validation Results:*" | |
} | |
}, | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "${{ env.mondoo_status != '0' && '*Mondoo:* ❌ Failed\n' || '*Mondoo:* ✅ Passed\n' }}${{ env.cnquery_status != '0' && '*cnquery:* ❌ Failed\n' || '*cnquery:* ✅ Passed\n' }}${{ env.cnspec_status != '0' && '*cnspec:* ❌ Failed' || '*cnspec:* ✅ Passed' }}" | |
} | |
}, | |
{ | |
"type": "context", | |
"elements": [ | |
{ | |
"type": "mrkdwn", | |
"text": "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View GitHub Action Run>" | |
} | |
] | |
} | |
] | |
} | |
- name: Final status check | |
if: env.mondoo_status != '0' || env.cnquery_status != '0' || env.cnspec_status != '0' | |
run: exit 1 |