Bug 1337861 - [Fennec-Relpro] Enforce the presence of $MOZ_BUILD_DATE r=jlund
MozReview-Commit-ID: DzEeeYQjwLW
--- 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,