I end my test step with a simple script that scan a pytest output.log and should exit with -1 if failed, so the job becomes red and not green:
scripts:
- lots of test steps
- bash -c -l "python bin/status.py --statusfile=output.log; exit $?"
But the gitlab-ci-runner returns 0:
20200930123055|ERROR|bin/status.py:53|failed in line:173
'========================= 2 failed, 5 passed in 16.91s =========================' so returning -1 to shell
Uploading artifacts for successful job
00:01
Uploading artifacts...
output.log: found 1 matching files and directories
Uploading artifacts as "archive" to coordinator... ok id=2750517 responseStatus=201 Created token=5Gh42zsB
Job succeeded
program is returning proper exitcode:
python.exe .\bin\status.py --statusfile=C:\users\mobj\Downloads\output.log
20200930124542|ERROR|.\bin\status.py:53|failed in line:99 '=================== 1 failed, 5 passed, 1 skipped in 16.20s ====================' so returning -1 to shell
$?
False
python.exe .\bin\status.py --statusfile=C:\users\mobj\Downloads\output2.log
$?
True
I tried using bin/status.py --statusfile=output.log
in sh, but this complains file not found.