Title: [266088] trunk/Tools
Revision
266088
Author
aakash_j...@apple.com
Date
2020-08-24 15:45:09 -0700 (Mon, 24 Aug 2020)

Log Message

[ews] set references header in email so as to group similar emails together
https://bugs.webkit.org/show_bug.cgi?id=215777

Reviewed by Jonathan Bedard.

* BuildSlaveSupport/ews-build/send_email.py:
(send_email): Add support for setting references header.
(send_email_to_patch_author):
(send_email_to_bot_watchers):
* BuildSlaveSupport/ews-build/steps.py:
(AnalyzeCompileWebKitResults.send_email_for_new_build_failure): Set references header appropriately.
(ReRunWebKitTests.send_email_for_flaky_failure): Ditto.
(AnalyzeLayoutTestsResults.send_email_for_flaky_failure): Ditto.
(AnalyzeLayoutTestsResults.send_email_for_pre_existing_failure): Ditto.
(AnalyzeLayoutTestsResults.send_email_for_new_test_failures): Ditto.

Modified Paths

Diff

Modified: trunk/Tools/BuildSlaveSupport/ews-build/send_email.py (266087 => 266088)


--- trunk/Tools/BuildSlaveSupport/ews-build/send_email.py	2020-08-24 22:36:02 UTC (rev 266087)
+++ trunk/Tools/BuildSlaveSupport/ews-build/send_email.py	2020-08-24 22:45:09 UTC (rev 266088)
@@ -42,7 +42,7 @@
         return []
 
 
-def send_email(to_emails, subject, text):
+def send_email(to_emails, subject, text, reference=''):
     if is_test_mode_enabled:
         return
     if not to_emails:
@@ -59,6 +59,9 @@
     msg['From'] = FROM_EMAIL
     msg['To'] = ', '.join(to_emails)
     msg['Subject'] = subject
+    msg.add_header('reply-to', 'aakash_j...@apple.com')
+    if reference:
+        msg.add_header('references', '{}@webkit.org'.format(reference))
 
     server = smtplib.SMTP(SERVER)
     server.sendmail(FROM_EMAIL, to_emails, msg.as_string())
@@ -65,14 +68,14 @@
     server.quit()
 
 
-def send_email_to_patch_author(author_email, subject, text):
+def send_email_to_patch_author(author_email, subject, text, reference=''):
     if not author_email:
         return
     if author_email in get_email_ids('EMAIL_IDS_TO_UNSUBSCRIBE'):
         print('email {} is in unsubscribe list, skipping email'.format(author_email))
         return
-    send_email([author_email], subject, text)
+    send_email([author_email], subject, text, reference)
 
 
-def send_email_to_bot_watchers(subject, text):
-    send_email(get_email_ids('BOT_WATCHERS_EMAILS'), subject, text)
+def send_email_to_bot_watchers(subject, text, reference=''):
+    send_email(get_email_ids('BOT_WATCHERS_EMAILS'), subject, text, reference)

Modified: trunk/Tools/BuildSlaveSupport/ews-build/steps.py (266087 => 266088)


--- trunk/Tools/BuildSlaveSupport/ews-build/steps.py	2020-08-24 22:36:02 UTC (rev 266087)
+++ trunk/Tools/BuildSlaveSupport/ews-build/steps.py	2020-08-24 22:45:09 UTC (rev 266088)
@@ -1490,7 +1490,7 @@
                 logs = logs.replace('&', '&amp;').replace('<', '&lt;').replace('>', '&gt;')
                 email_text += u'\n\nError lines:\n\n<code>{}</code>'.format(logs)
             email_text += '\n\nTo unsubscrible from these notifications or to provide any feedback please email aakash_j...@apple.com'
-            send_email_to_patch_author(patch_author, email_subject, email_text)
+            send_email_to_patch_author(patch_author, email_subject, email_text, patch_id)
         except Exception as e:
             print('Error in sending email for new build failure: {}'.format(e))
 
@@ -2027,7 +2027,7 @@
             email_subject = u'Flaky test: {}'.format(test_name)
             email_text = 'Test {} flaked in {}\n\nBuilder: {}'.format(test_name, build_url, builder_name)
             email_text = 'Flaky test: {}\n\nBuild: {}\n\nBuilder: {}\n\nWorker: {}\n\nHistory: {}'.format(test_name, build_url, builder_name, worker_name, history_url)
-            send_email_to_bot_watchers(email_subject, email_text)
+            send_email_to_bot_watchers(email_subject, email_text, 'flaky-{}'.format(test_name))
         except Exception as e:
             # Catching all exceptions here to ensure that failure to send email doesn't impact the build
             print('Error in sending email for flaky failures: {}'.format(e))
@@ -2125,7 +2125,7 @@
 
             email_subject = u'Flaky test: {}'.format(test_name)
             email_text = 'Flaky test: {}\n\nBuild: {}\n\nBuilder: {}\n\nWorker: {}\n\nHistory: {}'.format(test_name, build_url, builder_name, worker_name, history_url)
-            send_email_to_bot_watchers(email_subject, email_text)
+            send_email_to_bot_watchers(email_subject, email_text, 'flaky-{}'.format(test_name))
         except Exception as e:
             print('Error in sending email for flaky failure: {}'.format(e))
 
@@ -2138,7 +2138,7 @@
 
             email_subject = u'Pre-existing test failure: {}'.format(test_name)
             email_text = 'Test {} failed on clean tree run in {}.\n\nBuilder: {}\n\nWorker: {}\n\nHistory: {}'.format(test_name, build_url, builder_name, worker_name, history_url)
-            send_email_to_bot_watchers(email_subject, email_text)
+            send_email_to_bot_watchers(email_subject, email_text, 'preexisting-{}'.format(test_name))
         except Exception as e:
             print('Error in sending email for pre-existing failure: {}'.format(e))
 
@@ -2164,7 +2164,7 @@
             email_text += '\n\nFull details are available at: {}\n\nPatch author: {}'.format(build_url, patch_author)
             email_text += '\n\nLayout test failure{}:\n{}'.format(pluralSuffix, test_names_string)
             email_text += '\n\nTo unsubscrible from these notifications or to provide any feedback please email aakash_j...@apple.com'
-            send_email_to_patch_author(patch_author, email_subject, email_text)
+            send_email_to_patch_author(patch_author, email_subject, email_text, patch_id)
         except Exception as e:
             print('Error in sending email for new layout test failures: {}'.format(e))
 

Modified: trunk/Tools/ChangeLog (266087 => 266088)


--- trunk/Tools/ChangeLog	2020-08-24 22:36:02 UTC (rev 266087)
+++ trunk/Tools/ChangeLog	2020-08-24 22:45:09 UTC (rev 266088)
@@ -1,3 +1,21 @@
+2020-08-24  Aakash Jain  <aakash_j...@apple.com>
+
+        [ews] set references header in email so as to group similar emails together
+        https://bugs.webkit.org/show_bug.cgi?id=215777
+
+        Reviewed by Jonathan Bedard.
+
+        * BuildSlaveSupport/ews-build/send_email.py:
+        (send_email): Add support for setting references header.
+        (send_email_to_patch_author):
+        (send_email_to_bot_watchers):
+        * BuildSlaveSupport/ews-build/steps.py:
+        (AnalyzeCompileWebKitResults.send_email_for_new_build_failure): Set references header appropriately.
+        (ReRunWebKitTests.send_email_for_flaky_failure): Ditto.
+        (AnalyzeLayoutTestsResults.send_email_for_flaky_failure): Ditto.
+        (AnalyzeLayoutTestsResults.send_email_for_pre_existing_failure): Ditto.
+        (AnalyzeLayoutTestsResults.send_email_for_new_test_failures): Ditto.
+
 2020-08-24  Jonathan Bedard  <jbed...@apple.com>
 
         [resultsdbpy] Fix pip package
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to