Skip to content

Powershell job succeeds when a script tries to run an absent executable

Summary

Sometimes a programmer may make a mistake in a name/path of a script to run, but a job succeeds in that erroneous case.

Steps to reproduce

  1. Setup a CI on a Windows Powershell runner
  2. Setup a .gitlab-ci.yml with the content like the following
  job:
     script:
         - ./run-something-absent.exe
  1. Trigger a job run
  2. Look into job log. There is an error but job succeeds.

Actual behavior

Job prints an error but succeeds (exit code is 0).

Expected behavior

Job fails with non-zero exit code.

Relevant logs and/or screenshots

$ ./run-something-absent.exe
The term './run-something-absent.exe' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Users\builder\AppData\Local\Temp\CI\TMP\build_script801541191\script.ps1:103 char:27
+ ./run-something-absent.exe <<<< 
    + CategoryInfo          : ObjectNotFound: (./run-something-absent.exe:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
 
Job succeeded

Used GitLab Runner version

Version:      10.7.2
Git revision: b5e03c94
Git branch:   
GO version:   go1.8.7
Built:        2018-05-14T11:52:33+00:00
OS/Arch:      windows/amd64

The same issue is observed with a runner built from the latest sources.

Edited by Alexey Shumkin