i try to execute commands inside wsl on a windows gitlab runner with a powershell executer. But i cant find a way to creat any outcome.
This was my minimal starting setup that i try to run:
qsys-build:
stage: build
script:
- wsl -e bash -c "ls"
This runs fine and the pipeline succeed but the command is not producing any output.
I then wrote a short .ps1 script that i execute in the pipeline. Here i pipe the output of the command into a variable and then printing the variable:
$wslOutput = wsl -e bash -c 'ls'
Write-Output "wsl -e bash -c 'ls': $wslOutput"
This gives me the output: "wsl -e bash -c 'ls': a c c e s s d e n i e d"
Then i added my user to the gitlabl runner service inside windows, that the pipeline is executed with my admin rights. This is then only changing from "access denied" to an empty output again.
When i execute these commands in a powershell directly all commands are fine. So there need to be any trick or misconfiguration?
I already serched throught many diffent threads and even discussed with chatGPT and phind.com without any luck.
So i thaught maybe I'm on the wrong track but i can't be the only one trying this (despite the fact that other uses this exact same command without any problems like here). What is the correct way of using wsl inside a gitlab pipeline or where can i dig into to find the missing part here? Any thaugts or hints what I'm doing wrong is highly appreciated.