Recently one of our PowerShell scripts failed but the pipeline didn't abort because Jenkins considered the PowerShell script to be succesful.
You can reproduce the problem with the following example pipeline script:
This script should fail because of ErrorActionPreference = 'Stop' and because Copy-Item will return an error because the file doesn't exist (resulting in $? = False).
I assume that this happens because the PowerShell plugin first checks for $LASTEXITCODE, which was set to 0 by the "cmd" command. The problem is that $? isn't checked as well.
|Field||Original Value||New Value|
|Assignee||Gabriel Loewen [ gabloe ]|
|Status||Open [ 1 ]||In Progress [ 3 ]|
|Status||In Progress [ 3 ]||In Review [ 10005 ]|
|Resolution||Fixed [ 1 ]|
|Status||In Review [ 10005 ]||Closed [ 6 ]|