Bug 218227

Summary: [ews] Ensure that uat instance doesn't send emails
Product: WebKit Reporter: Aakash Jain <aakash_jain>
Component: Tools / TestsAssignee: Aakash Jain <aakash_jain>
Status: RESOLVED FIXED    
Severity: Normal CC: aakash_jain, darin, jbedard, krollin, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Other   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=222035
https://bugs.webkit.org/show_bug.cgi?id=235552
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Description Aakash Jain 2020-10-27 05:18:09 PDT
uat instance (ews-buidl.webkit-uat.org) is for testing purposes and various times it runs queues/configurations which aren't ready for production yet. We should ensure that uat instance doesn't send emails to users.
Comment 1 Aakash Jain 2020-10-27 05:26:55 PDT
Created attachment 412414 [details]
Patch
Comment 2 Darin Adler 2020-10-27 14:26:23 PDT
Comment on attachment 412414 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=412414&action=review

> Tools/BuildSlaveSupport/ews-build/send_email.py:52
> +    if 'uat' in HOSTNAME:

This seems like an imprecise check. Is there no chance that a host might have "uat" as a substring of its name? It’s in words like "graduate".
Comment 3 Keith Rollin 2020-10-27 14:32:35 PDT
Heh. The word that came to my mind was "squat".

The domain in question was "https://ews-build.webkit-uat.org". Would it cause problems to look for "ews-build.webkit-uat.org"? Or "webkit-uat.org"? Or "webkit-uat"? or "-uat.org"?
Comment 4 Darin Adler 2020-10-27 14:36:56 PDT
(In reply to Keith Rollin from comment #3)
> The domain in question was "https://ews-build.webkit-uat.org". Would it
> cause problems to look for "ews-build.webkit-uat.org"? Or "webkit-uat.org"?
> Or "webkit-uat"? or "-uat.org"?

or "-uat." or /\buat\b/
Comment 5 Aakash Jain 2020-10-28 06:35:43 PDT
(In reply to Keith Rollin from comment #3)
> Would it cause problems to look for "ews-build.webkit-uat.org"? Or "webkit-uat.org"? Or "webkit-uat"? or "-uat.org"?
Not really. This particular check is specifically for this host.

In fact any other host matching this check isn't much of a concern, since almost all other hosts will fail the previous check of is_test_mode_enabled. is_test_mode_enabled is disabled only when BUILDBOT_PRODUCTION env variable is set, which is not set by default. We need to set this variable on uat instance since we need it to mimic production environment (e.g.: reading passwords.json file so that we can easily connect bots to it).

Also, no other instance (like local testing instance) should send emails.

Instead of disallowing this particular host, I have reverted the check in updated patch to allow only one host: production EWS instance.
Comment 6 Aakash Jain 2020-10-28 06:38:46 PDT
Created attachment 412525 [details]
Patch
Comment 7 Aakash Jain 2020-10-28 08:21:13 PDT
Created attachment 412529 [details]
Patch
Comment 8 EWS 2020-10-28 09:17:14 PDT
Committed r269106: <https://trac.webkit.org/changeset/269106>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 412529 [details].
Comment 9 Radar WebKit Bug Importer 2020-10-28 09:18:20 PDT
<rdar://problem/70766615>