bug 1431799 - add helper version functions in rr3. r=mtabara
authorAki Sasaki <asasaki@mozilla.com>
Fri, 26 Jan 2018 14:06:35 -0800
changeset 8527 99b39094a9368707e8f6c0cb8965d49a957136f5
parent 8526 b1f0bcac283c7dce647b520d222feebfdc43f82f
child 8528 d867e7cc12e416b8fdcd7f00cf638b604d3937ce
push id279
push userasasaki@mozilla.com
push dateTue, 06 Feb 2018 18:39:34 +0000
reviewersmtabara
bugs1431799
bug 1431799 - add helper version functions in rr3. r=mtabara MozReview-Commit-ID: AIZ2d503YNS
buildfarm/release/release-runner3.py
--- a/buildfarm/release/release-runner3.py
+++ b/buildfarm/release/release-runner3.py
@@ -85,16 +85,46 @@ def run_prebuild_sanity_checks(release_r
         except Exception as e:
             release_runner.mark_as_failed(
                 release, 'Sanity checks failed. Errors: %s' % e)
             log.exception(
                 'Sanity checks failed. Errors: %s. Release: %s', e, release)
     return new_valid_releases
 
 
+def is_beta(version):
+    return "b" in version
+
+
+def is_esr(version):
+    return "esr" in version
+
+
+def is_rc(release):
+    if not is_beta(release['version']) and not is_esr(release['version']):
+        if isFinalRelease(release["version"]):
+            return True
+        # RC release types will enable beta-channel testing &
+        # shipping. We need this for all "final" releases
+        # and also any releases that include a beta as a partial.
+        # The assumption that "shipping to beta channel" always
+        # implies other RC behaviour is bound to break at some
+        # point, but this works for now.
+        for version in release["partial_updates"]:
+            if is_beta(version):
+                return True
+    return False
+
+
+def get_beta_num(version):
+    if is_beta(version):
+        parts = version.split('b')
+        return int(parts[-1])
+
+
 def main(options):
     log.info('Loading config from %s' % options.config)
 
     with open(options.config, 'r') as config_file:
         config = yaml.load(config_file)
 
     if config['release-runner'].get('verbose', False):
         log_level = logging.DEBUG
@@ -160,36 +190,24 @@ def main(options):
             if "partial_updates" in release:
                 action_task_input["partial_updates"] = {}
                 for version, info in release["partial_updates"].items():
                     action_task_input["partial_updates"][version] = {
                         "buildNumber": info["buildNumber"],
                         "locales": info["locales"]
                     }
             if release["product"] == "firefox":
-                if "b" in release["version"]:
+                if is_beta(release["version"]):
                     action_task_input["desktop_release_type"] = "beta"
-                elif "esr" in release["version"]:
+                elif is_esr(release["version"]):
                     action_task_input["desktop_release_type"] = "esr"
+                elif is_rc(release):
+                    action_task_input["desktop_release_type"] = "rc"
                 else:
-                    # RC release types will enable beta-channel testing &
-                    # shipping. We need this for all "final" releases
-                    # and also any releases that include a beta as a partial.
-                    # The assumption than "shipping to beta channel" always
-                    # implies other RC behaviour is bound to break at some
-                    # point, but this works for now.
-                    if isFinalRelease(release["version"]):
-                        action_task_input["desktop_release_type"] = "rc"
-                    else:
-                        for version in release["partial_updates"]:
-                            if "b" in version:
-                                action_task_input["desktop_release_type"] = "rc"
-                                break
-                        else:
-                            action_task_input["desktop_release_type"] = "release"
+                    action_task_input["desktop_release_type"] = "release"
             elif release["product"] == "devedition":
                 action_task_input["desktop_release_type"] = "devedition"
             action_task_id, action_task = generate_action_task(
                 project=release["branchShortName"],
                 revision=release["mozillaRevision"],
                 action_task_input=action_task_input,
             )
             submit_action_task(queue=queue, action_task_id=action_task_id,