Bug 1552682 - Fix fallback for wpt manifest download, r=ato
authorJames Graham <james@hoppipolla.co.uk>
Mon, 20 May 2019 21:52:06 +0000
changeset 474695 561a328e09ea3fc0e5fe93cf0c9d803b4695186f
parent 474694 6d2b52f066bf543dbbcbc3299de5147332392d82
child 474696 2ad581fafc85ab939d75f7aa1a2f901f45ecb113
push id36044
push userrmaries@mozilla.com
push dateTue, 21 May 2019 15:45:34 +0000
treeherdermozilla-central@78571bb1f20e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersato
bugs1552682
milestone69.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 1552682 - Fix fallback for wpt manifest download, r=ato It seems like bool(req) was evaluated as False and there were several error paths where we didn't fall back to a reasonable default URL. Fixing this should mean we almost never fall back to not downloading anything Differential Revision: https://phabricator.services.mozilla.com/D31872
testing/web-platform/manifestdownload.py
--- a/testing/web-platform/manifestdownload.py
+++ b/testing/web-platform/manifestdownload.py
@@ -67,55 +67,57 @@ def taskcluster_url(logger, commits):
     artifact_path = '/artifacts/public/manifests.tar.gz'
 
     cset_url = ('https://hg.mozilla.org/mozilla-central/json-pushes?'
                 'changeset={changeset}&version=2&tipsonly=1')
 
     tc_url = ('https://index.taskcluster.net/v1/task/gecko.v2.mozilla-central.'
               'revision.{changeset}.source.manifest-upload')
 
+    default = ("https://index.taskcluster.net/v1/task/gecko.v2.mozilla-central."
+               "latest.source.manifest-upload" +
+               artifact_path)
+
     for revision in commits:
         req = None
 
         if revision == 40 * "0":
             continue
         try:
             req_headers = HEADERS.copy()
             req_headers.update({'Accept': 'application/json'})
             req = get(logger, cset_url.format(changeset=revision),
                       headers=req_headers)
             req.raise_for_status()
         except requests.exceptions.RequestException:
-            if req and req.status_code == 404:
+            if req is not None and req.status_code == 404:
                 # The API returns a 404 if it can't find a changeset for the revision.
                 continue
             else:
-                return False
+                return default
 
         result = req.json()
 
         pushes = result['pushes']
         if not pushes:
             continue
         [cset] = pushes.values()[0]['changesets']
 
         try:
             req = get(logger, tc_url.format(changeset=cset))
         except requests.exceptions.RequestException:
-            return False
+            return default
 
         if req.status_code == 200:
             return tc_url.format(changeset=cset) + artifact_path
 
     logger.info("Can't find a commit-specific manifest so just using the most "
                 "recent one")
 
-    return ("https://index.taskcluster.net/v1/task/gecko.v2.mozilla-central."
-            "latest.source.manifest-upload" +
-            artifact_path)
+    return default
 
 
 def download_manifest(logger, test_paths, commits_func, url_func, force=False):
     manifest_paths = [item["manifest_path"] for item in test_paths.itervalues()]
 
     if not force and not should_download(logger, manifest_paths):
         return True