Gitlab runner doesn't check out any code

Hi all, wondering if you can help.

I have a gitlab-runner running for my .Net project, and it’s picking up jobs and building them. However, it’s not checking out the code correctly, and I’m not sure why. The output is as follows (ids changed for anonymity):

Running with gitlab-runner (10.6.0) (xxxx)
  on my-runner (123456)
Using Shell executor...
Running on myhost...
Cloning repository
Cloning into 'C:/Gitlab/Runner/builds/123456/0/myuser/my-project'...
$ call "%VS140COMNTOOLS%\vsvars32.bat"
$ call "run-msbuild.cmd"
'run-msbuild.cmd' is not recognized as an internal or external command, operable program or batch file. 
ERROR: Job failed, exit status 1

When I go and rummage in the build folder under the runner, I can see that the clone didn’t pull out any of the code (including the run-msbuild.cmd batch file). There is just

C:/Gitlab/Runner/builds/123456/0/myuser/my-project
C:/Gitlab/Runner/builds/123456/0/myuser/my-project.tmp

If I change the runner setting to use Clone rather than Fetch, nothing is pulled out at all.

The my-project folder contains nothing but a .git folder. The my-project.tmp folder contains git-template and CI_SERVER_TLS_CA_FILE. If I navigate into the my-project folder and run git pull, it checks out the code. If I then run the runner (with checkout set to use Fetch) the build runs and succeeds.

Any idea what’s going on here? It’s like the clone is failing, or trying to check out the wrong hash. But I’m reasonably new to git so not sure how to get to the bottom of this. :slight_smile:

1 Like

Did you ever find a fix for this?