Bug 1330668 - Generate balrog_props.json for l10n repacks. r=aki draft
authorJustin Wood <Callek@gmail.com>
Thu, 12 Jan 2017 17:14:25 -0500
changeset 462558 c23b9311f0b897884aac7aafa9a84463655957c5
parent 462557 3e02f55b2b211139351a2045fb16dcde78df5238
child 462559 dd2736c8f683350655628b3411cea82319f4ddae
push id41806
push userCallek@gmail.com
push dateTue, 17 Jan 2017 19:17:18 +0000
reviewersaki
bugs1330668
milestone53.0a1
Bug 1330668 - Generate balrog_props.json for l10n repacks. r=aki Needed to support beetmover and balrog. ToDo: attribute this cset to changes on date. MozReview-Commit-ID: 430QCIe7tM7
testing/mozharness/configs/single_locale/tc_android-api-15.py
testing/mozharness/scripts/desktop_l10n.py
testing/mozharness/scripts/mobile_l10n.py
--- a/testing/mozharness/configs/single_locale/tc_android-api-15.py
+++ b/testing/mozharness/configs/single_locale/tc_android-api-15.py
@@ -1,9 +1,10 @@
 config = {
+    "stage_platform": "android-api-15",
     "locales_file": "src/mobile/android/locales/all-locales",
     "tools_repo": "https://hg.mozilla.org/build/tools",
     "mozconfig": "src/mobile/android/config/mozconfigs/android-api-15/l10n-nightly",
     "tooltool_config": {
         "manifest": "mobile/android/config/tooltool-manifests/android/releng.manifest",
         "output_dir": "%(abs_work_dir)s/src",
     },
     "tooltool_servers": ['http://relengapi/tooltool/'],
--- a/testing/mozharness/scripts/desktop_l10n.py
+++ b/testing/mozharness/scripts/desktop_l10n.py
@@ -917,19 +917,16 @@ class DesktopSingleLocale(LocalesMixin, 
         for key in dirs.keys():
             if key not in abs_dirs:
                 abs_dirs[key] = dirs[key]
         self.abs_dirs = abs_dirs
         return self.abs_dirs
 
     def submit_to_balrog(self):
         """submit to balrog"""
-        if not self.config.get("balrog_servers"):
-            self.info("balrog_servers not set; skipping balrog submission.")
-            return
         self.info("Reading buildbot build properties...")
         self.read_buildbot_config()
         # get platform, appName and hashType from configuration
         # common values across different locales
         config = self.config
         platform = config["platform"]
         hashType = config['hashType']
         appName = config['appName']
@@ -939,19 +936,33 @@ class DesktopSingleLocale(LocalesMixin, 
         self.set_buildbot_property("appName", appName)
         # it's hardcoded to sha512 in balrog.py
         self.set_buildbot_property("hashType", hashType)
         self.set_buildbot_property("platform", platform)
         # values common to the current repacks
         self.set_buildbot_property("buildid", self._query_buildid())
         self.set_buildbot_property("appVersion", self.query_version())
 
-        # submit complete mar to balrog
-        # clean up buildbot_properties
-        self._map(self.submit_repack_to_balrog, self.query_locales())
+        # YAY
+        def balrog_props_wrapper(locale):
+            env = self._query_upload_env()
+            props_path = os.path.join(env["UPLOAD_PATH"], locale,
+                                      'balrog_props.json')
+            self.generate_balrog_props(props_path)
+            return SUCCESS
+
+        if self.config.get('taskcluster_nightly'):
+            self._map(balrog_props_wrapper, self.query_locales())
+        else:
+            if not self.config.get("balrog_servers"):
+                self.info("balrog_servers not set; skipping balrog submission.")
+                return
+            # submit complete mar to balrog
+            # clean up buildbot_properties
+            self._map(self.submit_repack_to_balrog, self.query_locales())
 
     def submit_repack_to_balrog(self, locale):
         """submit a single locale to balrog"""
         # check if locale has been uploaded, if not just return a FAILURE
         if locale not in self.package_urls:
             self.error("%s is not present in package_urls. Did you run make upload?" % locale)
             return FAILURE
 
--- a/testing/mozharness/scripts/mobile_l10n.py
+++ b/testing/mozharness/scripts/mobile_l10n.py
@@ -713,61 +713,78 @@ class MobileSingleLocale(MockMixin, Loca
         return bool(self.config.get("is_release_or_beta"))
 
     def submit_to_balrog(self):
 
         if not self.query_is_nightly() and not self.query_is_release_or_beta():
             self.info("Not a nightly or release build, skipping balrog submission.")
             return
 
-        if not self.config.get("balrog_servers"):
-            self.info("balrog_servers not set; skipping balrog submission.")
-            return
-
         self.checkout_tools()
 
         dirs = self.query_abs_dirs()
         locales = self.query_locales()
-        balrogReady = True
-        for locale in locales:
-            apk_url = self.query_upload_url(locale)
-            if not apk_url:
-                self.add_failure(locale, message="Failed to detect %s url in make upload!" % (locale))
-                balrogReady = False
-                continue
-        if not balrogReady:
-            return self.fatal(message="Not all repacks successful, abort without submitting to balrog")
+        if not self.config.get('taskcluster_nightly'):
+            balrogReady = True
+            for locale in locales:
+                apk_url = self.query_upload_url(locale)
+                if not apk_url:
+                    self.add_failure(locale, message="Failed to detect %s url in make upload!" % (locale))
+                    balrogReady = False
+                    continue
+            if not balrogReady:
+                return self.fatal(message="Not all repacks successful, abort without submitting to balrog")
 
+        env = self.query_upload_env()
         for locale in locales:
             apkfile = self.query_apkfile_path(locale)
-            apk_url = self.query_upload_url(locale)
+            if self.config.get('taskcluster_nightly'):
+                # Taskcluster needs stage_platform
+                self.set_buildbot_property("stage_platform",
+                                           self.config.get("stage_platform"))
+                self.set_buildbot_property("branch", self.config.get("branch"))
+            else:
+                apk_url = self.query_upload_url(locale)
+                self.set_buildbot_property("completeMarUrl", apk_url)
+
+                # The Balrog submitter translates this platform into a build target
+                # via https://github.com/mozilla/build-tools/blob/master/lib/python/release/platforms.py#L23
+                self.set_buildbot_property(
+                    "platform",
+                    self.buildbot_config["properties"]["platform"])
+                #TODO: Is there a better way to get this?
 
             # Set other necessary properties for Balrog submission. None need to
             # be passed back to buildbot, so we won't write them to the properties
             #files.
             self.set_buildbot_property("locale", locale)
 
             self.set_buildbot_property("appVersion", self.query_version())
-            # The Balrog submitter translates this platform into a build target
-            # via https://github.com/mozilla/build-tools/blob/master/lib/python/release/platforms.py#L23
-            self.set_buildbot_property("platform", self.buildbot_config["properties"]["platform"])
-            #TODO: Is there a better way to get this?
 
             self.set_buildbot_property("appName", "Fennec")
             # TODO: don't hardcode
             self.set_buildbot_property("hashType", "sha512")
             self.set_buildbot_property("completeMarSize", self.query_filesize(apkfile))
             self.set_buildbot_property("completeMarHash", self.query_sha512sum(apkfile))
-            self.set_buildbot_property("completeMarUrl", apk_url)
             self.set_buildbot_property("isOSUpdate", False)
             self.set_buildbot_property("buildid", self.query_buildid())
 
-            if self.query_is_nightly():
-                self.submit_balrog_updates(release_type="nightly")
+            if self.config.get('taskcluster_nightly'):
+                props_path = os.path.join(env["UPLOAD_PATH"], locale,
+                                          'balrog_props.json')
+                self.generate_balrog_props(props_path)
             else:
-                self.submit_balrog_updates(release_type="release")
-        if not self.query_is_nightly():
-            self.submit_balrog_release_pusher(dirs)
+                if not self.config.get("balrog_servers"):
+                    self.info("balrog_servers not set; skipping balrog submission.")
+                    return
+
+                if self.query_is_nightly():
+                    self.submit_balrog_updates(release_type="nightly")
+                else:
+                    self.submit_balrog_updates(release_type="release")
+
+                if not self.query_is_nightly():
+                    self.submit_balrog_release_pusher(dirs)
 
 # main {{{1
 if __name__ == '__main__':
     single_locale = MobileSingleLocale()
     single_locale.run_and_exit()