Bug 1306421 - Add is_taskcluster to ScriptMixin; r=armenzg
authorGregory Szorc <gps@mozilla.com>
Thu, 29 Sep 2016 12:50:57 -0700
changeset 315800 dcd89f87bf8601e6c40f2a361edc92c5d95b15e8
parent 315799 51199a9bdf29e063ddce5ce36db6bdd9ada10014
child 315801 7de011ec6e45a2e5019ecae87acacb8bb2a8f381
push id20634
push usercbook@mozilla.com
push dateFri, 30 Sep 2016 10:10:13 +0000
treeherderfx-team@afe79b010d13 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersarmenzg
bugs1306421
milestone52.0a1
Bug 1306421 - Add is_taskcluster to ScriptMixin; r=armenzg So we can detect when we're running on TaskCluster. This will be used to adjust environment settings accordingly. MozReview-Commit-ID: JEG1E3tWsc5
testing/mozharness/mozharness/base/script.py
--- a/testing/mozharness/mozharness/base/script.py
+++ b/testing/mozharness/mozharness/base/script.py
@@ -1662,16 +1662,20 @@ class ScriptMixin(PlatformMixin):
                         bundle.extract(entry, path=extract_to)
             except tarfile.TarError as e:
                 self.log('%s (%s)' % (e.message, filename),
                          level=error_level, exit_code=fatal_exit_code)
         else:
             self.log('No extraction method found for: %s' % filename,
                      level=error_level, exit_code=fatal_exit_code)
 
+    def is_taskcluster(self):
+        """Returns boolean indicating if we're running in TaskCluster."""
+        return 'TASKCLUSTER_INSTANCE_TYPE' in os.environ
+
 
 def PreScriptRun(func):
     """Decorator for methods that will be called before script execution.
 
     Each method on a BaseScript having this decorator will be called at the
     beginning of BaseScript.run().
 
     The return value is ignored. Exceptions will abort execution.