How to access c:\ on a windows machine with gitlab runner and bash as the shell
<ul>
<li>I have a gitlab runner running on a Windows Server 2012 machine.   </li>
<li>I have installed win-bash and added the location of the bash executable to the system path.</li>
<li>I have configured the runners config.toml file to use bash for the shell</li>
<li>I have a python script stored on the machine that I need to run as part of the build process.  This script is stored on the windows machine and is located at c:\path\to\script.py</li>
<li>The first line in my build script prints the working directory <code>pwd</code> and returns this: <code>/home/gitlab-runner/builds/2b321e5b/0/Firmware/PSoC5LP</code></li>
</ul>

<p>My question is this: How do I get access to the C:\ drive?  </p>

<p>I am running on a windows machine, and starting bash from any other terminal (cmd.exe, powershell, running the bash.exe directly) puts me into the standard windows directory structure from wherever I start bash:</p>

<pre><code>Microsoft Windows [Version 6.2.9200]
(c) 2012 Microsoft Corporation. All rights reserved.

C:\Users\Administrator\Desktop&gt;bash
bash$ pwd
C:/Users/Administrator/Desktop
bash$ cd /
bash$ pwd
C:/
bash$ cd /home
bash: /home: No such file or directory
bash$ ls
$Recycle.Bin               ProgramData
BOOTNXT                    System Volume Information
Documents and Settings     Users
Miniconda2                 Windows
Multi-Runner               bootmgr
PerfLogs                   cygwin64
Program Files              gitrepos
Program Files (x86)        pagefile.sys
bash$
</code></pre>

<p>no /home/, not a standard linux directory structure in sight.  Because of this, my build scripts fail since they are not able to access the files via there absolute path (I don't even know what their relative paths would look like in the runners bash context)</p>

<p>here is the relevant portion of my build script:</p>

<pre><code>#!/bin/bash

echo "build script executing"

pwd
echo "ls /"
ls /

echo "***assembling the LyteByte asm files"

# move to the LyteByteAssember directory
cd ./LyteByteAssembler/

ASSEMBLY_FILE="LyteByteAssembly.lbasm"
MERGE_FILE="merge.lbasm"
OUTPUT_FILE="../BootloaderProj.cydsn/lytebyte_prog_mem_init.c"
TEMP_DIR="./"
PREPROCESSOR_DIRECTORY="c:/gitrepos/ArcherTools/LyteByteAsembler/LyteBytePreProcessor.py"

echo $PREPROCESSOR_DIRECTORY $ASSEMBLY_FILE $MERGE_FILE $TEMP_DIR
python "$PREPROCESSOR_DIRECTORY" "$ASSEMBLY_FILE" "$MERGE_FILE" "$TEMP_DIR"

if [ $? -eq 0 ]
then
     echo "Preprocessing succeeded!"
else
     echo "Preprocessing failed, process cancelled"
     exit 1
fi
</code></pre>

<p>and here is a sample output from the runner:</p>

<pre><code>gitlab-ci-multi-runner 1.1.3 (a470667)
Using Shell executor...
Running on ip-172-31-7-232...
Fetching changes...
HEAD is now at d51e873 hjkj
From https://thing.githost.io/Firmware/PSoC5LP
   d51e873..d77e88b  CI         -&gt; origin/CI
Checking out d77e88b0 as CI...
Previous HEAD position was d51e873... hjkj
HEAD is now at d77e88b... ;jkblkn .,/p
$ bash ./build_script.sh
build script executing
/home/gitlab-runner/builds/2b321e5b/0/Firmware/PSoC5LP
ls /
bin
boot
cgroup
dev
etc
home
lib
lib64
local
lost+found
media
mnt
opt
proc
root
run
sbin
selinux
srv
sys
tmp
usr
var
***assembling the LyteByte asm files
c:/gitrepos/ArcherTools/LyteByteAsembler/LyteBytePreProcessor.py LyteByteAssembly.lbasm merge.lbasm ./
python: can't open file 'c:/gitrepos/ArcherTools/LyteByteAsembler/LyteBytePreProcessor.py': [Errno 2] No such file or directory
Preprocessing failed, process cancelled
</code></pre>