Fix path separator for CI_PROJECT_DIR in Windows in bash shells
What does this MR do?
This fix decides whether to turn /
into \
only if the path contains a Windows drive letter (e.g. C:/gitlab-runner
or C:\gitlab-runner
) and happens on a Windows OS.
Why was this MR needed?
To finish a community contribution (!1546 (closed))
Are there points in the code the reviewer needs to double check?
I changed from using a regexp to leveraging filepath.VolumeName
. The differences are:
-
filepath.VolumeName
takes into consideration UNC paths -
filepath.VolumeName
only causesplatformAppropriatePath
to do any transformation if running a Windows runner. I'm assuming that's the only scenario where we'll wantCI_BUILDS_DIR
andCI_PROJECT_DIR
to have these path changes.
Does this MR meet the acceptance criteria?
-
Documentation created/updated -
Added tests for this feature/bug -
In case of conflicts with master
- branch was rebased
What are the relevant issue numbers?
- closes #4524 (closed)
- closes #2841 (closed)
Edited by Steve Xuereb