]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
teuthology: add email headers for suite/user email-qa-headers 1925/head
authorPatrick Donnelly <pdonnell@redhat.com>
Mon, 11 Mar 2024 16:37:23 +0000 (12:37 -0400)
committerPatrick Donnelly <pdonnell@redhat.com>
Tue, 12 Mar 2024 19:48:13 +0000 (15:48 -0400)
For advanced filtering/organization.

Fixes: https://tracker.ceph.com/issues/64839
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
teuthology/results.py
teuthology/run.py

index aae991eaf1e00ade90e41e8529bb6f07d0a94b35..b72695e51d92aa79da4bf372096762416047ccb9 100644 (file)
@@ -75,15 +75,11 @@ def results(archive_dir, name, email, timeout, dry_run):
         print("Subject: %s" % subject)
         print(body)
     elif email:
-        email_results(
-            subject=subject,
-            from_=(config.results_sending_email or 'teuthology'),
-            to=email,
-            body=body,
-        )
+        sender = config.results_sending_email or 'teuthology'
+        email_results(config, subject, sender, to, body)
 
 
-def email_results(subject, from_, to, body):
+def email_results(config, subject, from_, to, body):
     log.info('Sending results to {to}: {body}'.format(to=to, body=body))
     import smtplib
     from email.mime.text import MIMEText
@@ -91,6 +87,12 @@ def email_results(subject, from_, to, body):
     msg['Subject'] = subject
     msg['From'] = from_
     msg['To'] = to
+    suite = config.get('suite')
+    if suite is not None:
+        msg['QA-suite'] = suite
+    user = config.get('user')
+    if user is not None:
+        msg['QA-user'] = user
     log.debug('sending email %s', msg.as_string())
     smtp = smtplib.SMTP('localhost')
     smtp.sendmail(msg['From'], [msg['To']], msg.as_string())
index e065495cff1f8e35a04ae42659644a5b3ee2f35b..2e97956df7cff2021826d6f24a170e44b4b01516 100644 (file)
@@ -281,9 +281,8 @@ def report_outcome(config, archive, summary, fake_ctx):
             and not passed):
         config_dump = yaml.safe_dump(config)
         subject = "Teuthology error -- %s" % summary['failure_reason']
-        email_results(subject, "Teuthology", config['email-on-error'],
-            "\n".join([summary_dump, config_dump]))
-
+        body = "\n".join([summary_dump, config_dump])
+        email_results(config, subject, "Teuthology", body)
 
     report.try_push_job_info(config, summary)