Check and adjust alerts #33
Workflow file for this run
This file contains hidden or 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: Check Alerts using Promtool | |
| on: | |
| pull_request: | |
| paths: | |
| - '**/*.rules.yaml' | |
| - '**/*.alerts.yaml' | |
| # Cortex core alerts related files. | |
| # They will be used | |
| - '**/cortex-core/templates/alerts.yaml' | |
| - '**/ci/core-alert-values.yaml' | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout PR | |
| uses: actions/checkout@v5 | |
| - name: Install Helm | |
| uses: azure/setup-helm@v4 | |
| with: | |
| version: '3.12.0' | |
| - name: Render alert templates | |
| run: | | |
| chmod +x scripts/render-alerts.sh | |
| ./scripts/render-alerts.sh | |
| - name: Get all alert files (static + rendered) | |
| id: alert-files | |
| run: | | |
| # Find static alert files | |
| # Exclude rendered template files | |
| static_files=$(find . -name "*.alerts.yaml" -o -name "*.rules.yaml" | grep -v rendered | tr '\n' ' ') | |
| # Find rendered alert files | |
| rendered_files=$(find . -path "*/rendered/alerts.yaml" | tr '\n' ' ') | |
| # Combine all files | |
| all_files="$static_files $rendered_files" | |
| echo "files=$all_files" >> $GITHUB_OUTPUT | |
| echo "Found alert files: $all_files" | |
| - name: Check changed rule and alert files via promtool | |
| if: steps.changed.outputs.any_changed == 'true' | |
| uses: peimanja/[email protected] | |
| with: | |
| promtool_actions_subcommand: 'rules' | |
| promtool_actions_files: ${{ steps.changed.outputs.all_changed_files }} | |
| promtool_actions_version: 'latest' | |
| promtool_actions_comment: 'false' |