Bug 1337861 - [Fennec-Relpro] Enforce the presence of $MOZ_BUILD_DATE r=jlund draft
authorJohan Lorenzo <jlorenzo@mozilla.com>
Thu, 23 Feb 2017 19:23:19 +0100
changeset 567123 78e57dee284f00302fc30cf93f57b5fa748049c9
parent 567113 e17cbb839dd225a2da7e5d5bec43cf94e11749d8
child 625527 21e09ecde3aa611616caaf3f5f60f4ee893392d5
push id55446
push userbmo:jlorenzo@mozilla.com
push dateMon, 24 Apr 2017 12:22:15 +0000
reviewersjlund
bugs1337861
milestone55.0a1
Bug 1337861 - [Fennec-Relpro] Enforce the presence of $MOZ_BUILD_DATE r=jlund MozReview-Commit-ID: DzEeeYQjwLW
testing/mozharness/mozharness/mozilla/building/buildbase.py
--- a/testing/mozharness/mozharness/mozilla/building/buildbase.py
+++ b/testing/mozharness/mozharness/mozilla/building/buildbase.py
@@ -790,26 +790,37 @@ or run without that action (ie: --no-{ac
 
     def query_buildid(self):
         c = self.config
         if self.buildid:
             return self.buildid
 
         buildid = None
         if c.get("is_automation"):
-            if self.buildbot_config['properties'].get('buildid'):
-                self.info("Determining buildid from buildbot properties")
-                buildid = self.buildbot_config['properties']['buildid'].encode(
-                    'ascii', 'replace'
-                )
+            if self.buildbot_config.get('properties'):
+                # We're on buildbot
+                if self.buildbot_config.get('properties').get('buildid'):
+                    # Try may not provide a buildid. This means, it's gonna be generated
+                    # below.
+                    self.info("Determining buildid from buildbot properties")
+                    buildid = self.buildbot_config['properties']['buildid'].encode(
+                        'ascii', 'replace'
+                    )
             else:
-                # for taskcluster, there are no buildbot properties, and we pass
+                # We're on taskcluster.
+                # In this case, there are no buildbot properties, and we must pass
                 # MOZ_BUILD_DATE into mozharness as an environment variable, only
                 # to have it pass the same value out with the same name.
-                buildid = os.environ.get('MOZ_BUILD_DATE')
+                try:
+                    buildid = os.environ['MOZ_BUILD_DATE']
+                except KeyError:
+                    self.fatal(
+                        "MOZ_BUILD_DATE must be provided as an environment var on Taskcluster"
+                    )
+
 
         if not buildid:
             self.info("Creating buildid through current time")
             buildid = generate_build_ID()
 
         if c.get('is_automation'):
             self.set_buildbot_property('buildid',
                                        buildid,