Unified knowledge operator & CRD #86
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 alert template and related files. | |
| # These files are monitored for changes to trigger rendering and validation | |
| # of cortex-alerts/templates/alerts.yaml with promtool. | |
| - '**/cortex-alerts/templates/alerts.yaml' | |
| - '**/ci/core-alert-values.yaml' | |
| - '**/helm/render-alerts.sh' | |
| 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: Install tools | |
| run: | | |
| # Install yq | |
| sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 | |
| sudo chmod +x /usr/local/bin/yq | |
| - name: Render alert templates | |
| run: | | |
| chmod +x helm/render-alerts.sh | |
| ./helm/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.alert-files.outputs.files != '' | |
| uses: peimanja/[email protected] | |
| with: | |
| promtool_actions_subcommand: 'rules' | |
| promtool_actions_files: ${{ steps.alert-files.outputs.files }} | |
| promtool_actions_version: 'latest' | |
| promtool_actions_comment: 'false' |