Bug 1455407: [releaserunner3] Allow specifying notification email per-product; r=mtabara
authorTom Prince <mozilla@hocat.ca>
Fri, 08 Jun 2018 16:18:06 +0000
changeset 8423 db9d67c3554f
parent 8422 88b450a68f24
child 8424 54446ea4e817
push id6150
push usermozilla@hocat.ca
push dateFri, 08 Jun 2018 16:55:49 +0000
reviewersmtabara
bugs1455407
Bug 1455407: [releaserunner3] Allow specifying notification email per-product; r=mtabara This will allow notifying tb-drivers for thunderbird releases. Differential Revision: https://phabricator.services.mozilla.com/D1595
buildfarm/release/release-runner3.py
--- a/buildfarm/release/release-runner3.py
+++ b/buildfarm/release/release-runner3.py
@@ -39,17 +39,25 @@ def check_and_assign_long_revision(relea
         release['branch'], release['mozillaRevision'])
 
 
 def get_trust_domain(releases_config, release):
     product = release['product']
     for entry in releases_config:
         if entry['product'] == product:
             return entry['trust_domain']
-    raise RuntimeError("Unknown trust-domain for product %s", product)
+    raise RuntimeError("Unknown product %s", product)
+
+
+def get_notify_to(releases_config, release, default):
+    product = release['product']
+    for entry in releases_config:
+        if entry['product'] == product:
+            return entry.get("notify_to_announce", default)
+    raise RuntimeError("Unknown product %s", product)
 
 
 def check_allowed_branches(release_runner, release, releases_config):
     product = release['product']
     branch = release['branch']
     for entry in releases_config:
         if entry['product'] == product:
             allowed_branches = entry['allowed_branches']
@@ -165,18 +173,16 @@ def main(options):
 
     github_token = config['git']['github_token']
     partner_config = deepcopy(config['partners'])
     rr_config = config['release-runner']
     sleeptime = rr_config['sleeptime']
     smtp_server = rr_config.get('smtp_server', 'localhost')
     notify_from = rr_config.get('notify_from')
     notify_to = rr_config.get('notify_to_announce')
-    if isinstance(notify_to, basestring):
-        notify_to = [x.strip() for x in notify_to.split(',')]
 
     rr = ReleaseRunner(api_root=api_root, username=username, password=password)
     tc_config = {
         "credentials": {
             "clientId": config["taskcluster"].get("client_id"),
             "accessToken": config["taskcluster"].get("access_token"),
         },
         "maxRetries": 12,
@@ -248,17 +254,18 @@ def main(options):
                 decision_task_id=decision_task_id,
                 action_task_input=action_task_input,
             )
             submit_action_task(queue=queue, action_task_id=action_task_id,
                                action_task=action_task)
             rr.mark_as_completed(release)
             l10n_url = rr.release_l10n_api.getL10nFullUrl(release['name'])
             email_release_drivers(smtp_server=smtp_server, from_=notify_from,
-                                  to=notify_to, release=release,
+                                  to=[get_notify_to(config['releases'], release, notify_to)],
+                                  release=release,
                                   task_group_id=action_task_id, l10n_url=l10n_url)
         except Exception as exception:
             # We explicitly do not raise an error here because there's no
             # reason not to start other releases if creating the Task Graph
             # fails for another one. We _do_ need to set this in order to exit
             # with the right code, though.
             rc = 2
             rr.mark_as_failed(