You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
Hi @Doug Harriman ,
You should be able to check the exist code of the pipeline step in the after-script section of the step https://bitbucket.org/blog/after-scripts-now-available-for-bitbucket-pipelines.
pipelines: default: - step: name: Build and test script: - npm install - npm test after-script: - if [[ BITBUCKET_EXIT_CODE -eq 0 ]]; then exit 0; else echo "Step failed"
- pipe: atlassian/email-notify:0.3.8
BODY_PLAIN: "Build failed!"
The BITBUCKET_EXIT_CODE variable is available in the after-script. The value will be 0 of the step is successful and 1 if the step has failed.
We tried to implement this suggestion, but get the following error :
if [[ BITBUCKET_EXIT_CODE -eq 0 ]]; then exit 0; else echo "Step failed";
bash: /opt/atlassian/pipelines/agent/tmp/bashScript1288869279188383501.sh: line 96: syntax error: unexpected end of file
Any input would be appreciated.
If anyone is still struggling to get the above snippet to work.
You can turn on notifications from the repo itself in Bitbucket.
1. Go the repository you want to monitor
2. On the Source tab, click the ellipsis and select Manage Notifications
3. Click Watch this repository
Now when a pipeline fails you should get an email alert
Hi @Alexander Zhukov ,
I am also getting same error like...
if [[ BITBUCKET_EXIT_CODE -eq 0 ]]; then exit 0; else echo "Step failed"
bash: /opt/atlassian/pipelines/agent/tmp/bashScript4568911739432207606.sh: line 94: syntax error: unexpected end of file
Also i have tried @Goinnn 's trick, but i didn't work for me. Please help me.
I'm a bit late but try this:
if [[ BITBUCKET_EXIT_CODE -eq 0 ]]; then exit 0; else echo "Step failed"; fi;
Also, did you get this implemented?
In the logs it says "Sending email..." and then "
✖ Failed to send email to <TO-email>. Check your configuration settings."
What needs to be filled in 'username' and 'from' fields?