I am experiencing a problem where Bamboo does not seem to respect the exit code from docker compose to determine whether a task was successful or not. I configured the task as described below. As you can see in the log output below, the docker-compose process exits with status 1. Bamboo ignores this status code and reports the task as success.
docker-compose -f test/docker-compose.yml up --exit-code-from tests
Where docker-compose is:
command: bash -c "cp -R /data/. /workdir && npm install && npm run test"
tests_1 | npm ERR! code ELIFECYCLE
tests_1 | npm ERR! Exit status 1
test_tests_1 exited with code 1
Aborting on container exit...
Finished task 'Script' with result: Success
I'll need more details about the task running the docker-compose command.
If you are using a script task, there is an explanation for this issue and a fix using the proper configuration.
If we consider Bash, all the commands from a script will run even if any previous command failed. The script itself (or an inline script from a script task) will by default only return the error code of the last command run. To change this behavior you need to use the set -e command to configure the terminal interpreter to stop the script if any command return a non zero error.
This is one example of a thread with a similar issue:
We’re preparing for Bamboo 8.0, which will be our first Data Center release. To make sure our app vendors and customers with written in-house apps are prepared, we’re launching Bamboo 8.0 Early Acces...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events