Bug 1337861 - [Fennec-Relpro] Enforce the presence of $MOZ_BUILD_DATE r=jlund
authorJohan Lorenzo <jlorenzo@mozilla.com>
Thu, 23 Feb 2017 19:23:19 +0100
changeset 354552 2f45a2547cb49cf6e1579c4079bb44ec7426af2e
parent 354551 4b90d988f6545cba07ea63e9fb9f42bd2db136fe
child 354553 9965cf60d2b79d81149b9ceec540f0629372729f
push id41360
push userjlorenzo@mozilla.com
push dateMon, 24 Apr 2017 15:43:01 +0000
treeherderautoland@2f45a2547cb4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjlund
bugs1337861
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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,