Bug 1492664 - update fetch-content to use TASKCLUSTER_ROOT_URL; r=tomprince

--HG--
extra : rebase_source : ae5064b8cf13ee50b4db0299e4b7fad215902af1
extra : source : 742b038bb1dd39c029afce73eb3f5b683cb590f2
This commit is contained in:
Dustin J. Mitchell 2018-10-02 14:40:39 +00:00
Родитель baf08548f8
Коммит 60d0a26a65
1 изменённых файлов: 19 добавлений и 9 удалений

Просмотреть файл

@ -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)