Bug 1539970 - Support taskcluster cache env var in mozproxy. r=tarek
authorEric Rahm <erahm@mozilla.com>
Fri, 29 Mar 2019 17:12:37 +0000
changeset 466796 67251e93f756baf940c1ddc9a382b35b76dd4f75
parent 466795 7d8d318ea0627102c14b211ab487042563b122b8
child 466797 e27fc0c01a979c6b8a423846e0461bdebe70eef4
push id35780
push useropoprus@mozilla.com
push dateFri, 29 Mar 2019 21:53:01 +0000
treeherdermozilla-central@414f37afbe07 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstarek
bugs1539970
milestone68.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 1539970 - Support taskcluster cache env var in mozproxy. r=tarek TaskCluster tasks use the `TOOLTOOL_CACHE` env var to specify which directory to use for the `tooltool` cache. This patch falls back to that value if `TOOLTOOLCACHE` is not found. Differential Revision: https://phabricator.services.mozilla.com/D25305
testing/mozbase/mozproxy/mozproxy/utils.py
--- a/testing/mozbase/mozproxy/mozproxy/utils.py
+++ b/testing/mozbase/mozproxy/mozproxy/utils.py
@@ -71,24 +71,24 @@ def tooltool_download(manifest, run_loca
     """Download a file from tooltool using the provided tooltool manifest"""
 
     def outputHandler(line):
         LOG.info(line)
 
     if run_local:
         command = [sys.executable, TOOLTOOL_PATH, "fetch", "-o", "-m", manifest]
     else:
-        # we want to use the tooltool cache in production
-        if os.environ.get("TOOLTOOLCACHE") is not None:
-            _cache = os.environ["TOOLTOOLCACHE"]
-        else:
-            # XXX top level dir? really?
-            # that gets run locally on any platform
-            # when you call ./mach python-test
-            _cache = "/builds/tooltool_cache"
+        # Attempt to determine the tooltool cache path:
+        #  - TOOLTOOLCACHE is used by Raptor tests
+        #  - TOOLTOOL_CACHE is automatically set for taskcluster jobs
+        #  - fallback to a hardcoded path
+        _cache = next(x for x in (
+                    os.environ.get("TOOLTOOLCACHE"),
+                    os.environ.get("TOOLTOOL_CACHE"),
+                    "/builds/tooltool_cache") if x is not None)
 
         command = [
             sys.executable,
             TOOLTOOL_PATH,
             "fetch",
             "-o",
             "-m",
             manifest,