-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvalidate-prometheus-alerts.yaml
More file actions
51 lines (42 loc) · 1.41 KB
/
validate-prometheus-alerts.yaml
File metadata and controls
51 lines (42 loc) · 1.41 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
# SPDX-FileCopyrightText: 2026 SAP SE or an SAP affiliate company and cobaltcore-dev contributors
# SPDX-License-Identifier: Apache-2.0
name: Validate Prometheus Alerts
on:
workflow_dispatch:
pull_request:
paths:
- 'charts/openstack-hypervisor-operator/alerts/*.yaml'
- 'charts/openstack-hypervisor-operator/alerts/*.yml'
permissions:
contents: read
env:
PROMTOOL_VERSION: 3.8.0
defaults:
run:
shell: bash
concurrency:
group: validate-prometheus-alerts-${{ github.ref }}
cancel-in-progress: true
jobs:
validate-alerts:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v6
- name: Install promtool
run: |
set -euo pipefail
curl -sSfL "https://github.com/prometheus/prometheus/releases/download/v${PROMTOOL_VERSION}/prometheus-${PROMTOOL_VERSION}.linux-amd64.tar.gz" \
| tar xz --strip-components=1 "prometheus-${PROMTOOL_VERSION}.linux-amd64/promtool"
sudo install -m 0755 promtool /usr/local/bin/promtool
promtool --version
- name: Validate Prometheus alert rules
run: |
set -euo pipefail
shopt -s nullglob
files=(charts/openstack-hypervisor-operator/alerts/*.{yaml,yml})
if [ ${#files[@]} -eq 0 ]; then
echo "No Prometheus rule files found."
exit 1
fi
promtool check rules "${files[@]}"