Bug 1252333 - tweak release runner to handle all releases except firefox betas which are handled by promotion now. r=rail old-release-runner
authorMihai Tabara <mtabara@mozilla.com>
Fri, 04 Mar 2016 12:07:08 -0800
branchold-release-runner
changeset 6559 5645f817628346d5069422be8240c196327f7fc5
parent 6287 34811624634fb4b3e0dc789b17db9bb439d94780
child 6712 716c6f38a6e7924aa87fd13ec9b59db74d25bafe
push id4898
push usermtabara@mozilla.com
push dateFri, 04 Mar 2016 20:07:40 +0000
reviewersrail
bugs1252333
Bug 1252333 - tweak release runner to handle all releases except firefox betas which are handled by promotion now. r=rail
buildfarm/release/release-runner.py
--- a/buildfarm/release/release-runner.py
+++ b/buildfarm/release/release-runner.py
@@ -1,15 +1,16 @@
 #!/usr/bin/env python
 
 import site
 import time
 import logging
 import sys
 import os
+import re
 import json
 from os import path
 from optparse import OptionParser
 from smtplib import SMTPException
 from functools import partial
 import textwrap
 from twisted.python.lockfile import FilesystemLock
 
@@ -28,16 +29,34 @@ from util.hg import mercurial, update, c
 from util.retry import retry
 from util.fabric.common import check_fabric, FabricHelper
 from util.sendmail import sendmail
 from util.file import load_config, get_config
 
 log = logging.getLogger(__name__)
 
 
+# temporary regex to filter out firefox desktop beta releases as they're
+# handled separately within release promotion. Once migration from buildbot
+# to promotion is completed for all types of releases, we will backout this
+# filtering  - bug 1252333
+RELEASE_PATTERNS = [
+    # all Firefox non-betas
+    r"Firefox-\d+\.\d+(\.\d+)?(esr)?-build\d+",
+    # all Fennec betas
+    r"Fennec-\d+\.0b\d+-build\d+",
+    # all Fennec non-betas
+    r"Fennec-\d+\.\d+(\.\d+)?-build\d+",
+    # all Thunderbird betas
+    r"Thunderbird-\d+\.0b\d+-build\d+",
+    # all Thunderbird non-betas
+    r"Thunderbird-\d+\.\d+(\.\d+)?-build\d+",
+]
+
+
 def reconfig_warning(from_, to, smtp_server, rr, start_time, elapsed,
                      proc):
     """Called when the buildbot master reconfigs are taking a long time."""
     started = time.strftime("%a, %d %b %Y %H:%M:%S %Z",
                             time.localtime(start_time))
     subject = "[release-runner] WARNING: Reconfig exceeded %s" % elapsed
     body = textwrap.dedent("""
     A buildbot master reconfig started at %(start_time)s has been running for
@@ -50,33 +69,45 @@ def reconfig_warning(from_, to, smtp_ser
             rr.update_status(
                 release, "Waiting on reconfig for %s" % elapsed)
         sendmail(from_=from_, to=to, subject=subject, body=body,
                  smtp_server=smtp_server)
     except SMTPException:
         log.error("Cannot send email", exc_info=True)
 
 
+def matches(name, patterns):
+    return any([re.search(p, name) for p in patterns])
+
+
 class ReleaseRunner(object):
     def __init__(self, api_root=None, username=None, password=None,
                  timeout=60):
         self.new_releases = []
         self.releases_api = Releases((username, password), api_root=api_root,
                                      timeout=timeout)
         self.release_api = Release((username, password), api_root=api_root,
                                    timeout=timeout)
         self.release_l10n_api = ReleaseL10n((username, password),
                                             api_root=api_root, timeout=timeout)
 
     def get_release_requests(self):
         new_releases = self.releases_api.getReleases()
         if new_releases['releases']:
-            self.new_releases = [self.release_api.getRelease(name) for name in
-                                 new_releases['releases']]
-            return True
+            new_releases = [self.release_api.getRelease(name) for name in
+                            new_releases['releases']]
+            our_releases = [r for r in new_releases if
+                            matches(r['name'], RELEASE_PATTERNS)]
+            if our_releases:
+                self.new_releases = our_releases
+                log.info("Releases to handle are %s", our_releases)
+                return True
+            else:
+                log.info("No releases to handle in %s", new_releases)
+                return False
         else:
             log.info("No new releases: %s" % new_releases)
             return False
 
     def get_release_l10n(self, release):
         return self.release_l10n_api.getL10n(release)
 
     def update_status(self, release, status):