Bug 1621845 - Normalize fetch path in fetch-content. r=rstewart

The win64-aarch64 have a kind of a nasty trick that makes fetch-content
download artifacts of a dependent task directly as artifacts of the task
itself. For some reason, while this pattern works on native Windows
jobs, it doesn't on Linux. What happens is essentially that:

  `pathlib.Path(path).joinpath('../foo').mkdir(parents=True, exist=ok=True)`

fails when path doesn't exist first. I guess the fetches directory
already exists on Windows worker or something.

Unfortunately, os.path.normpath doesn't take `pathlib.Path`s in
still-supported python 3.5, so we have to convert to str first.

Differential Revision: https://phabricator.services.mozilla.com/D66518

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mike Hommey 2020-03-19 08:18:37 +00:00
parent f1aee9ce8c
commit f8e37d2100

View File

@ -590,7 +590,8 @@ def command_task_artifacts(args):
for fetch in fetches:
extdir = pathlib.Path(args.dest)
if 'dest' in fetch:
extdir = extdir.joinpath(fetch['dest'])
# Note: normpath doesn't like pathlib.Path in python 3.5
extdir = pathlib.Path(os.path.normpath(str(extdir.joinpath(fetch['dest']))))
extdir.mkdir(parents=True, exist_ok=True)
root_url = os.environ['TASKCLUSTER_ROOT_URL']
if fetch['artifact'].startswith('public/'):