generated from cobaltcore-dev/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 5
53 lines (44 loc) · 1.57 KB
/
check-alerts.yaml
File metadata and controls
53 lines (44 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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 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.changed.outputs.any_changed == 'true'
uses: peimanja/promtool-github-actions@v0.0.2
with:
promtool_actions_subcommand: 'rules'
promtool_actions_files: ${{ steps.changed.outputs.all_changed_files }}
promtool_actions_version: 'latest'
promtool_actions_comment: 'false'