The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

trigger pipeline step on condition

Stève ZEMETA
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 26, 2025

Hi,

I am currently trying to implement a pipeline. But I check,I struggle to find a way to run a step of my pipeline on condition


definitions:
steps:
- step:
name: Run Test
size: 2x # Double the memory allocation
script:
- apk add --no-cache python3 py3-pip python3-dev gcc musl-dev linux-headers curl
- python3 -m venv venv
- source venv/bin/activate
    - step: 
name: Deploy
size: 2x # Double the memory allocation
script:
- echo "test"

- step:
name: Rollback
script:
- echo "Start rollback"



Could you plase help me find the best approach to run Step rollback only in condition that Step Deploy fails

Thank you

2 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

1 vote
Saxea _Flowie_
Atlassian Partner
February 26, 2025

Hi @Stève ZEMETA

You could possibly use after-script for this? Another option, if you require separated steps, would be to store the result of the deploy in a variable and share with the rollback step.

You might also find BCLOUD-20833 relevant to you.

0 votes
Adrian R_
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 26, 2025

I do not believe bitbucket supports a "Run on failure" condition. You might need to combine the deploy and rollback logic within the same step? For example, you can run a deploy script and then check the scripts exit code.

DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin Site Admin
TAGS
AUG Leaders

Atlassian Community Events