Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

How can i fail a pipeline if there is a failure in the script in the Build step ?

I am triggering a shell script within a step in the bitbucket-pipelines.

If for some reason there is error or failure in the shell script the status of the bitbucket-pipeline is still pass.

Any way or modification i need to do to fail the pipeline build if there is any kind of error in the shell script.

2 answers


In my case, this doesn't work. The solution I found is to return "exit 1" from the script. 



On pipeline : 

- step:
name: "Test"

- ./



sh ./ 

if [[ $? -ne 0 ]]; then
exit 1 #it will fail the pipeline


On my_second_script I am returning "exit 1" when I want to fail. 

0 votes

Hi @Rajat Gupta

Is it a bash shell script?
I'm afraid you need to set a special option to make sure the script itself will return an error in case any of its commands fail.

Please take a look at this article (bash - When to use set -e) and let me know if setting the environment options below, at the beginning of your script, will solve the issue:

set -eu
set -o pipefail
set -o pipefail


set: Illegal option -o pipefail

Not sure if this is still relevant.

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events