powershell cmdlet failure does not cause job failure
(moved from cdhunt/gitlab-runner#9 (closed))
When a cmdlet fails (willful typo here to make things obvious) the job is not seen as a failure, even with a non-docker runner:
$ New-Item -Path "VS" -ItemType SymbolicLinkkk -Value "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community"
New-Item : Le type n'est pas un type connu pour le syst�me de fichiers. Seuls �file�, �directory� et �symboliclink�
peuvent �tre sp�cifi�s.
Au caract�re Ligne:1 : 1
+ New-Item -Path "VS" -ItemType SymbolicLinkkk -Value "C:/Program Files ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument : (:) [New-Item], PSArgumentException
+ FullyQualifiedErrorId : Argument,Microsoft.PowerShell.Commands.NewItemCommand
Version: 10.7.0~beta.475.g595864a5
Git revision: 595864a5
Git branch: feature/docker-executor-windows
GO version: go1.9.4
Built: 2018-03-18T15:41:13+00:00
OS/Arch: windows/amd64
Uploading artifacts...
...
Job succeeded
If I stop the patched-for-docker runner and run the latest official one (11.1.0) on the same machine with same configuration (stop, replace gitlab-runner binary, start), the job now gets an immediate failure as expected:
$ New-Item -Path "VS" -ItemType SymbolicLinkkk -Value "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community"
New-Item : Le type n'est pas un type connu pour le syst�me de fichiers. Seuls �file�, �directory� et �symboliclink�
peuvent �tre sp�cifi�s.
Au caract�re C:\WINDOWS\TEMP\build_script019468171\script.ps1:123 : 1
+ New-Item -Path "VS" -ItemType SymbolicLinkkk -Value "C:/Program Files ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument : (:) [New-Item], PSArgumentException
+ FullyQualifiedErrorId : Argument,Microsoft.PowerShell.Commands.NewItemCommand
ERROR: Job failed: exit status 1
Edited by Yann Dirson