Bug 1277595 - Generate balrog properties as a taskcluster artifact, r=jlund draft
authoramiyaguchi@mozilla.com
Thu, 01 Sep 2016 09:22:45 -0700
changeset 408920 b444e1f9443dbaa5bb160163a3ce8c59ef71b723
parent 408919 371b54cb30cb043dffaf47f8167e78c00c2633b7
child 408921 b41f3ace2281caeeab8c8650da97d9445b66c5c7
push id28326
push userjlund@mozilla.com
push dateThu, 01 Sep 2016 21:00:13 +0000
reviewersjlund
bugs1277595
milestone51.0a1
Bug 1277595 - Generate balrog properties as a taskcluster artifact, r=jlund MozReview-Commit-ID: Bzx5yfVfZcw
testing/mozharness/mozharness/mozilla/building/buildbase.py
testing/mozharness/mozharness/mozilla/updates/balrog.py
--- a/testing/mozharness/mozharness/mozilla/building/buildbase.py
+++ b/testing/mozharness/mozharness/mozilla/building/buildbase.py
@@ -2035,16 +2035,25 @@ or run without that action (ie: --no-{ac
         """ submit balrog update steps. """
         if not self.query_is_nightly():
             self.info("Not a nightly build, skipping balrog submission.")
             return
 
         # grab any props available from this or previous unclobbered runs
         self.generate_build_props(console_output=False,
                                   halt_on_failure=False)
+
+        # generate balrog props as artifacts
+        if self.config.get('taskcluster_nightly'):
+            env = self.query_mach_build_env(multiLocale=False)
+            props_path = os.path.join(env["UPLOAD_PATH"],
+                    'balrog_props.json')
+            self.generate_balrog_props(props_path)
+            return
+
         if not self.config.get("balrog_servers"):
             self.fatal("balrog_servers not set; skipping balrog submission.")
             return
 
         if self.submit_balrog_updates():
             # set the build to orange so it is at least caught
             self.return_code = self.worst_level(
                 EXIT_STATUS_DICT[TBPL_WARNING], self.return_code,
--- a/testing/mozharness/mozharness/mozilla/updates/balrog.py
+++ b/testing/mozharness/mozharness/mozilla/updates/balrog.py
@@ -9,16 +9,37 @@ class BalrogMixin(object):
     @staticmethod
     def _query_balrog_username(server_config, product=None):
         username = server_config["balrog_usernames"].get(product)
         if username:
             return username
         else:
             raise KeyError("Couldn't find balrog username.")
 
+    def generate_balrog_props(self, props_path):
+        self.set_buildbot_property(
+            "hashType", self.config.get("hash_type", "sha512"), write_to_file=True
+        )
+
+        if self.buildbot_config and "properties" in self.buildbot_config:
+            buildbot_properties = self.buildbot_config["properties"].items()
+        else:
+            buildbot_properties = []
+
+        balrog_props = dict(properties=dict(chain(
+            buildbot_properties,
+            self.buildbot_properties.items(),
+        )))
+        if self.config.get('balrog_platform'):
+            balrog_props["properties"]["platform"] = self.config['balrog_platform']
+        if "branch" not in balrog_props["properties"]:
+            balrog_props["properties"]["branch"] = self.branch
+
+        self.dump_config(props_path, balrog_props)
+
     def submit_balrog_updates(self, release_type="nightly", product=None):
         c = self.config
         dirs = self.query_abs_dirs()
 
         if self.buildbot_config and "properties" in self.buildbot_config:
             product = self.buildbot_config["properties"]["product"]
 
         if product is None:
@@ -26,35 +47,19 @@ class BalrogMixin(object):
 
         props_path = os.path.join(dirs["base_work_dir"], "balrog_props.json")
         credentials_file = os.path.join(
             dirs["base_work_dir"], c["balrog_credentials_file"]
         )
         submitter_script = os.path.join(
             dirs["abs_tools_dir"], "scripts", "updates", "balrog-submitter.py"
         )
-        self.set_buildbot_property(
-            "hashType", c.get("hash_type", "sha512"), write_to_file=True
-        )
-
-        if self.buildbot_config and "properties" in self.buildbot_config:
-            buildbot_properties = self.buildbot_config["properties"].items()
-        else:
-            buildbot_properties = []
 
-        balrog_props = dict(properties=dict(chain(
-            buildbot_properties,
-            self.buildbot_properties.items(),
-        )))
-        if self.config.get('balrog_platform'):
-            balrog_props["properties"]["platform"] = self.config['balrog_platform']
-        if "branch" not in balrog_props["properties"]:
-            balrog_props["properties"]["branch"] = self.query_branch()
+        self.generate_balrog_props(props_path)
 
-        self.dump_config(props_path, balrog_props)
         cmd = [
             self.query_exe("python"),
             submitter_script,
             "--build-properties", props_path,
             "-t", release_type,
             "--credentials-file", credentials_file,
         ]
         if self._log_level_at_least(INFO):