diff --git a/taskcluster/scripts/misc/fetch-content b/taskcluster/scripts/misc/fetch-content index 0519afaf788f..735447155725 100755 --- a/taskcluster/scripts/misc/fetch-content +++ b/taskcluster/scripts/misc/fetch-content @@ -26,11 +26,6 @@ except ImportError: zstandard = None -PUBLIC_ARTIFACT_URL = ('https://queue.taskcluster.net/v1/task/{task}/artifacts/' - '{artifact}') -PRIVATE_ARTIFACT_URL = ('http://taskcluster/queue/v1/task/{task}/artifacts/' - '{artifact}') - CONCURRENCY = multiprocessing.cpu_count() @@ -377,6 +372,16 @@ def command_static_url(args): raise +def api(root_url, service, version, path): + # taskcluster-lib-urls is not available when this script runs, so + # simulate its behavior: + if root_url == 'https://taskcluster.net': + return 'https://{service}.taskcluster.net/{version}/{path}'.format( + service=service, version=version, path=path) + return 'https://{root_url}/api/{service}/{version}/{path}'.format( + root_url=root_url, service=service, version=version, path=path) + + def command_task_artifacts(args): fetches = json.loads(os.environ['MOZ_FETCHES']) downloads = [] @@ -385,12 +390,17 @@ def command_task_artifacts(args): if 'dest' in fetch: extdir = extdir.joinpath(fetch['dest']) extdir.mkdir(parents=True, exist_ok=True) + root_url = os.environ['TASKCLUSTER_ROOT_URL'] if fetch['artifact'].startswith('public/'): - url = PUBLIC_ARTIFACT_URL.format(task=fetch['task'], - artifact=fetch['artifact']) + path = 'task/{task}/artifacts/{artifact}'.format( + task=fetch['task'], artifact=fetch['artifact']) + url = api(root_url, 'queue', 'v1', path) else: - url = PRIVATE_ARTIFACT_URL.format(task=fetch['task'], - artifact=fetch['artifact']) + # Until bug 1460015 is finished, use the old baseUrl style proxy URLs + url = ('{proxy_url}/queue/v1/task/{task}/artifacts/{artifact}').format( + proxy_url=os.environ['TASKCLUSTER_PROXY_URL'], + task=fetch['task'], + artifact=fetch['artifact']) downloads.append((url, extdir, fetch['extract'])) fetch_urls(downloads)