From b5e9e1afb6c301a096994f3d9d286ead55c62bd8 Mon Sep 17 00:00:00 2001 From: Jeltz Date: Wed, 1 Nov 2023 23:32:03 +0100 Subject: [PATCH] add support for custom annotations --- bot.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/bot.py b/bot.py index 4d37fea..ad33f11 100755 --- a/bot.py +++ b/bot.py @@ -30,6 +30,10 @@ TEMPLATE_TEXT = ( "{{ labels.alertname }} {{ labels.instance }}" "{% if annotations.summary %}" "\n{{ annotations.summary }}" + "{% else %}" + "{% for key, value in annotations.items() %}" + "\n{{ key }} : {{ value }}" + "{% endfor %}" "{% endif %}" ) @@ -46,6 +50,13 @@ TEMPLATE_HTML = ( "{% if annotations.summary %}" "
" "
{{ annotations.summary }}
" + "{% else %}" + "
" + "" "{% endif %}" )