Script used for powershell runner doesn't produce error when powershell commands fail
Summary
When using CI/CD pipeline with a PowerShell runner, the script created by the runner checks the $? variable. If this variable is False, the script exits with $LASTEXITCODE. $LASTEXITCODE is either 0 when external commands have run successfully, or $null if only PowerShell commands have run.
Steps to reproduce
- Create a runner that uses PowerShell
- Create .gitlab-ci.yml file that has script for write-error "error" and some other commands
- Notice that the error is displayed, the next commands are never run and the job is successful
Example Project
https://gitlab.com/corbob/CI-CD-Runner-Example
What is the current bug behavior?
Job reports success
What is the expected correct behavior?
Job reports failure
Relevant logs and/or screenshots
Example:
Example output from a runner:
https://gitlab.com/corbob/CI-CD-Runner-Example/-/jobs/75183727
