Skip to content

Fix path separator for CI_PROJECT_DIR in Windows in bash shells

Pedro Pombeiro requested to merge mr-origin-1546 into master

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 causes platformAppropriatePath to do any transformation if running a Windows runner. I'm assuming that's the only scenario where we'll want CI_BUILDS_DIR and CI_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?

Edited by Steve Xuereb

Merge request reports