How to use a windows vm on virtualbox gitlab runner?

Viewed 35

I'm trying to run a windows vm in virtualbox and use it as a runner in git lab, following https://docs.gitlab.com/runner/executors/virtualbox.html#use-native-openssh-and-powershell

I installed native open ssh, git for windows and configured the default shell to be pwsh as they request:

New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "$PSHOME\pwsh.exe" -PropertyType String -Force

however SSH does not work. When I try to ssh to localhost:

ssh MACHINE_NAME\username@localhost

I get Permission denied, try again

when I do this. If I do

reg add HKLM\SOFTWARE\OpenSSH /v DefaultShell /d C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe

then I can ssh into my machine. THe gitlab can also, but then it complains that bash is not a command on power shell:

 00:02
bash : The term 'bash' is not recognized as the name of a cmdlet, function, script file, or 
operable program. Check the spelling of the name, or if a path was included, verify that the path 
is correct and try again.
At line:1 char:1
+ bash -l
+ ~~~~
    + CategoryInfo          : ObjectNotFound: (bash:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
 
ERROR: Job failed: prepare environment: Process exited with status 1. Check https://docs.gitlab.com/runner/shells/index.html#shell-profile-loading for more information

To fix that, I installed WSL and ubuntu on Windows, but then it gives

ERROR: Job failed: prepare environment: Process exited with status 1. Check https://docs.gitlab.com/runner/shells/index.html#shell-profile-loading for more information

this is a known problem in ubuntu which is fixed by removing .bash_logout but I can't do this to the WSL image. Also, installing WSL shouldn't be the way here, it should work without WSL.

0 Answers
Related