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
--- 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.