Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Inline script ignores error Edited

Hi there,

quick question: I have an inline script step in my build process which basically calls

 

docker-compose build
docker-compose push

 

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.

1 answer

1 vote

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?

Victor

Hi Victor,

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?

 

Ali

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?

Victor

Thanks for the link.

I seperated the task into two. Now I have to watch :-D


Thank you very much, Victor.

Like Victor Debone likes this

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bamboo

Bamboo 101 Video

G’day Community! As we gear up to introduce Bamboo Data Center to the world, we wanted to make sure that we shared a bit more about Bamboo, the product. Our team has put together an overview video ...

227 views 4 6
Read article

Community Events

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

Events near you