From 304fc48f3757ca46e4add2e47a7bf02953aedf1d Mon Sep 17 00:00:00 2001 From: Jeny Sadadia Date: Wed, 28 Aug 2024 12:59:46 +0530 Subject: [PATCH] Codec summary subscription script Script for generating email notifications for codec summary report. Signed-off-by: Jeny Sadadia --- kcidb/monitor/subscriptions/codec_summary.py | 32 ++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 kcidb/monitor/subscriptions/codec_summary.py diff --git a/kcidb/monitor/subscriptions/codec_summary.py b/kcidb/monitor/subscriptions/codec_summary.py new file mode 100644 index 00000000..aec1ccc1 --- /dev/null +++ b/kcidb/monitor/subscriptions/codec_summary.py @@ -0,0 +1,32 @@ +"""Codec summary subscription""" +from datetime import (timezone, datetime, timedelta) + +from kcidb.monitor.output import NotificationMessage as Message + + +def match_revision(revision): + """Match revisions for codec summary report from Maestro""" + + if revision.builds_valid is None: + return () + + # If the revision is not from 'maestro' origin + if not {c.origin for c in revision.checkouts} & {'maestro'}: + return () + + # If fluster tests not found + if not revision.tests_root["fluster"].nodes: + return () + + # Send notification 3 hours after a revision is created/updated + return (Message( + subject='KernelCI report for fluster tests: ' + '{% include "fluster_revision_summary.txt.j2" %}', + to=["Denis Yuji Shimizu "], + body='{% include "fluster_revision_description.txt.j2" %}', + cc=["KernelCI Results Staging ", + "Helen Mae Koike Fornazier ", + "Gustavo Padovan ", + "Jeny Sadadia "], + due=datetime.now(timezone.utc) + timedelta(hours=3) + ),)