Runner doesn't support long paths on Windows when downloading artifacts
Summary
When downloading artifacts with long paths on Windows, GitLab CI logs errors about creating directories and thus cannot put the files there.
WARNING: dev/containers/configservice/container/target/configservice-container-master-SNAPSHOT/configservice-container/webapps/configservice/WEB-INF/classes/com/company123/mft/configmgr/ui/client/constant/: mkdir dev/containers/configservice/container/target/configservice-container-master-SNAPSHOT/configservice-container/webapps/configservice/WEB-INF/classes/com/company123/mft/configmgr/ui/client/constant/: The filename or extension is too long. (suppressing repeats)
Steps to reproduce
In one stage, include artifacts which are in folders whose full paths will be longer than 260 characters.
In another stage, depend on the first stage so the artifacts will be downloaded from the coordinator.
Actual behavior
The directories with long paths are not created and the files are not placed within them.
Expected behavior
The directories should be created and the files places in those directories.
Relevant logs and/or screenshots
Downloading artifacts for Build (57814)...
Downloading artifacts from coordinator... ok id=57814 responseStatus=200 OK token=GR26X7Ns
WARNING: dev/containers/configservice/container/target/configservice-container-master-SNAPSHOT/configservice-container/webapps/configservice/WEB-INF/classes/com/company123/mft/configmgr/ui/client/constant/: mkdir dev/containers/configservice/container/target/configservice-container-master-SNAPSHOT/configservice-container/webapps/configservice/WEB-INF/classes/com/company123/mft/configmgr/ui/client/constant/: The filename or extension is too long. (suppressing repeats)
Environment description
- Windows Server 2016 Standard, English
- shell executor (cmd.exe)
- git 2.19.0.windows.1 with
core.longpaths=true
(so Git can support these long paths)
Used GitLab Runner version
Version: 11.3.1~beta.4.g0aa5179e
Git revision: 0aa5179e
Git branch: 11-3-stable
GO version: go1.8.7
Built: 2018-09-24T16:02:42+0000
OS/Arch: windows/amd64
Notes
This problem results when software uses older Windows APIs for accessing files. To deal with this issue, applications are expected to resolve relative paths if necessary, use Unicode versions of Windows APIs, and prefix paths with \\?\
, according to Microsoft.
It was noted in #125 (closed) that as a Go app, GitLab Runner could potentially use a library like syncthing/internal/osutil, which already supports long paths.