quick question: I have an inline script step in my build process which basically calls
Today I figured in hindsight, that the build-command failed with
error 18-Apr-2019 13:29:45 Service 'xxx' failed to build: Error processing tar file(exit status 1): mkdir /var/www/html/: no space left on device
which is fine, but bamboo continued with the push and everything was shiny and green.
Why bamboo doesn't fail?
Thanks in advance.
Hello @Ali Sahin, welcome to the community :)
In order to fail a build, an inline script must exit with a non-zero value.
If this error occurred inside Docker, or if I misunderstood the log, within the `docker-compose push` command. And regardless of the error, the command `docker-compose push` continued its execution, the Script task will not be able to understand the failure and stop the build.
Did it help you?
thanks for welcoming me.
The error did not occured inside a Docker. It occured on the build machine which indeed build the images. The build of one image failed and bamboo ignored that error and continued with 'docker-compose push'.
My expectation is, that bamboo fails when an error occurs in 'docker-compose build'.
How am I able to detect this and return a non-zoer value?
Ok, now I understand you better.
For this answer I assume you are running Bamboo in Linux. Because if you are running in Linux, your script task is running with bash, which makes sense from what you've described.
Bash scripts, if not altered or specified, will always exit with the exit code from the last command, which in your case is the `docker-compose push`. That is why Bamboo recognised it as a successful build, your `docker-compose push` worked.
Also, your script is defined in a way that regardless of the result of `docker-compose build`, the `docker-compose push` command will be run. So you probably want it to automatic exit it on error.
Alternatively, you could separate this task into two, and define an artifact to share the build result of `docker-compose`, and avoid the issue with errors getting lost in the script.
Did it help you?