'How to get GitLab Runner to work with Bash on Windows

I am trying to setup CI/CD within our GitLab instance to be run on a Windows 10 machine.

I have installed Git for Windows (which includes Git Bash) on the windows system.

I then register the runner according to the instructions given here.

I have then adjusted the config.toml file to use a bash shell, in this manner :

[[runners]]
  name = "DESKTOP-R9R6OV2"
  url = "https://git.mycompany.com/"
  token = "ozaxN3XoJm2sEPzc3BPx"
  executor = "shell"
  shell = "bash"
  builds_dir="/C/Build/"

As per this article - GitLab CI and Git Bash - I have created a bash.cmd file which contains

@"C:\Program Files\Git\usr\bin\bash.exe" -l

I have also ensured that C:\Program Files\Git and C:\Program Files\Git\usr\bin are in the global path definition as the runner is installed in the system admin account.

The pipeline kicks off, but seems to hang :

Running with gitlab-runner 14.7.0 (98daeee0)
  on DESKTOP-R9R6OV2 ozaxN3Xo
Preparing the "shell" executor
Using Shell executor...
Preparing environment

With the process waiting on Preparing environment

I have looked in the Event Viewer logs and there are no messages explaining what is going on.

So my question is, what else do I need to do to get the bash shell to work within GitLab Runner on a Windows 10 system ?

Are there special system permissions which need to be set ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source