Reputation: 63699
I'm trying to test my .gitlab-ci.yml
file for a .NET project locally, but am having trouble doing so. To be able to ask a useful question here I've tried to create instructions for a minimal repro, assuming a fully up to date Windows 10 Pro machine with Visual Studio 2017 installed.
c:\experiments\GlabTest
Install-Package NewtonSoft.Json
Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(1));
as the only line of code in the Main function.gitlab-ci.yml
file next to the sln
file with this content:
variables:
RELEASE_FOLDER: 'GlabTest/bin/Release'
MSBUILD: 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe'
stages:
- build
build_job:
stage: build
script:
- 'nuget restore'
- '& "$env:MSBUILD" GlabTest.sln /p:Configuration=Release /t:Rebuild'
artifacts:
paths:
- '$env:RELEASE_FOLDER\'
.gitignore
with this:
.vs/
**/[Pp]ackages/*
[Bb]in/
[Oo]bj/
git init
and git add .
and git commit -m "Weeee"
c:\gl\gitlab-runner-windows-amd64.exe
sln
folder& 'C:\gl\gitlab-runner-windows-amd64.exe' exec shell build_job
This will spit out all sorts of errors:
Since gitLab Runner 10.0 this command is marked as DEPRECATED
" without any hints on how to migrate away from exec
.../GlabTest/builds/0/project-0
)& was unexpected at this time.
" near the endall sorts of output issues, e.g. the last line is:
[31;1mERROR: Job failed: exit status 255
Before I dive deeper into a "DEPRECATED" command I should probably step back and ask: what is the recommended way to iterate locally a .gitlab-ci.yml
file with Powershell build on a Windows machine?
Upvotes: 1
Views: 1510
Reputation: 63699
[Why does it say DEPRECATED, what should we use instead?]
Well, there is not new way to do this, it seems exec
is being deprecated without a current replacement.
Cloning the repo into a subfolder of itself ...
No clue yet how to fix this.
& was unexpected at this time
That's because cmd
is the default shell on windows, so you should instead do:
& 'C:\gl\gitlab-runner-windows-amd64.exe' exec shell build_job --shell powershell
(Note the --shell powershell
at the end.)
all sorts of output issues
No clue what's going on there. Possibly your terminal isn't compatible with the way gitlab-runner.exe is trying to colorize output?
Upvotes: 1