Bug 1415212 - release-runner3 should pass partials to action task input r=mtabara draft
authorRail Aliiev <rail@mozilla.com>
Tue, 07 Nov 2017 11:29:14 -0500
changeset 8248 a856e115fe8328467faddc214897b592dba3c976
parent 8244 1503487430e56cd83936a5dd593ca175b94be2b8
push id264
push userbmo:rail@mozilla.com
push dateTue, 07 Nov 2017 16:29:20 +0000
reviewersmtabara
bugs1415212
Bug 1415212 - release-runner3 should pass partials to action task input r=mtabara MozReview-Commit-ID: KSSJ2jyVaPP
buildfarm/release/release-runner3.py
lib/python/kickoff/sanity/base.py
lib/python/kickoff/sanity/partials.py
--- a/buildfarm/release/release-runner3.py
+++ b/buildfarm/release/release-runner3.py
@@ -13,17 +13,19 @@ import taskcluster
 import time
 import yaml
 
 from os import path
 from twisted.python.lockfile import FilesystemLock
 
 site.addsitedir(path.join(path.dirname(__file__), "../../lib/python"))
 
-from kickoff import ReleaseRunner, long_revision, email_release_drivers, bump_version
+from kickoff import (ReleaseRunner, long_revision, email_release_drivers,
+                     bump_version, get_partials)
+from kickoff.sanity.partials import PartialsSanitizer
 from kickoff.sanity.revisions import RevisionsSanitizer
 from kickoff.actions import generate_action_task, submit_action_task, find_decision_task_id
 
 
 log = logging.getLogger(__name__)
 
 
 def check_and_assign_long_revision(release_runner, release, releases_config):
@@ -40,20 +42,27 @@ def check_allowed_branches(release_runne
         if entry['product'] == product:
             allowed_branches = entry['allowed_branches']
             for pattern in allowed_branches:
                 if re.match(pattern, branch):
                     return
     raise RuntimeError("%s branch not allowed: %s", branch, allowed_branches)
 
 
+def assign_and_check_partial_updates(release_runner, release, releases_config):
+    release['partial_updates'] = get_partials(
+        release_runner, release['partials'], release['product'])
+    PartialsSanitizer(**release).run()
+
+
 # So people can't run arbitrary functions
 CHECKS_MAPPING = {
     'long_revision': check_and_assign_long_revision,
     'check_allowed_branches': check_allowed_branches,
+    'partial_updates': assign_and_check_partial_updates,
 }
 
 
 def run_prebuild_sanity_checks(release_runner, releases_config):
     new_valid_releases = []
 
     # results in:
     # { 'firefox': ['long_revision', 'l10n_changesets', 'partial_updates']}
@@ -140,16 +149,23 @@ def main(options):
             revision = release["mozillaRevision"]
             decision_task_id = find_decision_task_id(project, revision)
             action_task_input = {
                 "build_number": release["buildNumber"],
                 "next_version": next_version,
                 "release_promotion_flavor": "promote_{}".format(release["product"]),
                 "previous_graph_ids": [decision_task_id],
             }
+            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"]
+                    }
             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,
                                action_task=action_task)
             rr.mark_as_completed(release)
--- a/lib/python/kickoff/sanity/base.py
+++ b/lib/python/kickoff/sanity/base.py
@@ -43,17 +43,17 @@ def is_candidate_release(channels):
 
     Because ship-it can not tell us if this is a candidate release (yet!),
     we assume it is when we have determined, based on version,
     that we are planning to ship to more than one update_channel
     e.g. for candidate releases we have:
      1) one channel to test the 'candidate' release with: 'beta' channel
      2) once verified, we ship to the main channel: 'release' channel
     """
-    return len(channels) > 1
+    return channels and len(channels) > 1
 
 
 class SanityException(Exception):
     """Should the release sanity process collect any errors, this
     custom exception is to be thrown in release runner.
     """
     pass
 
--- a/lib/python/kickoff/sanity/partials.py
+++ b/lib/python/kickoff/sanity/partials.py
@@ -87,17 +87,17 @@ class PartialsTestSuite(ReleaseSanitizer
 
     def test_partials_release_candidate_validity(self, result):
         """test_partials method
         Tests if a RC contains both beta and release in list of partials.
         We hit this issue in bug 1265579 in which the updates builder failed
         if partials were all-beta OR if no-beta at all
         """
         log.info("Testing RC partials ...")
-        if not is_candidate_release(self.kwargs["release_channels"]):
+        if not is_candidate_release(self.kwargs.get("release_channels")):
             log.info("Skipping this test as we're not dealing with a RC now")
             return
 
         ret = [matches(name, BETA_PATTERNS) for name in self.partial_updates]
         at_least_one_beta = any(ret)
         all_betas = all(ret) and ret != []
 
         partials = ["{name}".format(name=p) for p in self.partial_updates]