This seems very basic but I can't find it anywhere in the docs. I'm working on a project where we run some tests through a shell script wrapper like:
./foo.sh a
./foo.sh b
./foo.sh c
foo.sh
does not output XUnit format, so we need a different way to signal failure to CircleCI. Is exit 1
(or any nonzero exit code) recognized as a failure? What conditions cause CircleCI to report a step as having failed?
Yes, CircleCI fails the build if any command, whether it runs tests or not, exits with a non-zero exit code. Documented in the configuration reference.
These snippets pulled from the above link go into detail on why that's the case:
For jobs that run on Linux, the default value of the shell option is /bin/bash -eo pipefail
Descriptions of the -eo pipefail options are provided below.
-e
Exit immediately if a pipeline (which may consist of a single simple command), a subshell command enclosed in parentheses, or one of the commands executed as part of a command list enclosed by braces exits with a non-zero status.
-o pipefail
If pipefail is enabled, the pipeline’s return status is the value of the last (rightmost) command to exit with a non-zero status, or zero if all commands exit successfully. The shell waits for all commands in the pipeline to terminate before returning a value.