I have this test override:
test:
override:
- |
if ( [ $CIRCLE_BRANCH = 'staging' ] || [ $CIRCLE_BRANCH = 'master' ] ); then
docker run -d -p 0.0.0.0:8080:8080 my-app
else
./gradlew test itest
mkdir -p $CIRCLE_TEST_REPORTS/junit/
find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} $CIRCLE_TEST_REPORTS/junit/ \;
fi
and even when:
./gradlew test itest
FAILURE: Build failed with an exception.
The build passes as successful, now I implemented this ugly workaround:
test:
override:
- |
if ( [ $CIRCLE_BRANCH = 'staging' ] || [ $CIRCLE_BRANCH = 'master' ] ); then
docker run -d -p 0.0.0.0:8080:8080 my-app
else
./gradlew test itest
export EXIT=$?
mkdir -p $CIRCLE_TEST_REPORTS/junit/
find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} $CIRCLE_TEST_REPORTS/junit/ \;
if [ $EXIT -ne 0 ]; then
exit 1
fi
fi
And now it fails, but I wonder if I am missing something if this is actually a bug, maybe related to:
https://circleci.com/docs/rspec-exit-codes/
Here is a very simple example: