So - I am writing a script for running iOS tests based on changes in project (not important to topic probably).
Within the script, there is a command, which will run the tests:
cmd = "xcodebuild -workspace xxx.xcworkspace -scheme xxx -destination 'platform=iOS Simulator,name={0},OS=latest' -configuration Debug -derivedDataPath {1} test-without-building {2} -parallel-testing-enabled NO -enableCodeCoverage YES | xcpretty".format(os.environ['TEST_SIMULATOR_NAME'], os.environ['PWD'], result)
and is executed like this:
do(cmd)
The do()
method definition is (source):
def do(command):
return_code = call([ '/bin/bash', '-c', 'set -o pipefail; ' + command ])
Gitlab job settings:
manualUiTestsBasedOnChanges:
stage: uiTests
only: ...some conditions...
before_script:
- set -o pipefail
script:
- ../scripts/ci/run_UI_tests_based_on_changes.py
The problem with this is, that if a fail occurs within this script, it won't fail the job, even when set -o pipefail
is set in before script AND in in the do()
method. Visible on image below.
Any ideas why it's behaving like this?