How does Drone determine if a test was succesful or not? Once, when it failed to find a program to execute a command with, the test failed, as it should. Another time, when my bash script exited with exit 1
the test “succeeded”. If it does not look for exit codes, what does it do then?
the pipeline step fails if a non-zero exit code is returned by the docker container. You can examine the source code here. There are no known issues with how Drone reads the exit code nor have there been any reports from our users to this effect.
Then why
?
How does it determine the “main process” if I run several commands?
these commands:
commands:
- echo hello
- echo world
are converted to this script:
set -e
echo hello
echo world
and the above script is executed as the container entrypoint. If the entrypoint returns a non-zero exit code, the container returns a non-zero exit code. Drone uses the Docker remote API to get the container exit code here. This is how Drone has worked since 2013 so we are pretty confident in the implementation.
Here I have a green checkmark showing that everything is “OK”, but the script had a little bug, where it accidentally exit 1
, because the if condition was set the wrong way. Why is this “OK”?
first you should make sure the bash script uses set -e
to always exit on error. Also remember that bash ignores the exit code when you concatenate commands with &&
or ||
, and when you run a command in the background. If a command is failing, and your bash script returns a 0 exit code, it is a problem with the bash script.
Oh yes, forgot that one. You are right, then it was probably based on that. Thank you for your help!