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

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

Can you stop a pipeline from a script step?

Can I stop an entire pipeline from a script in a step without having it fail?

 

In our case we have multiple triggers for a pipeline, but it only has to run in a specific case, when all other processes have finished. 

 

I would like to stop all other steps if the check fails in the first step without failing the pipeline, because this is a known stop and therefore should not trigger a failed status.

 

My current alternative is to do the check on the start of each step, which works, but does not indicate stoped in the overview of the pipeline and is inefficient. 

 

Hope someone can help!

Thanks in advance.

2 answers

I would also be interested in a solution to this. Currently I've worked around it by merging my steps in a single script that does the initial check. If conditions aren't met it simply exits. Otherwise it continues calling each subsequent step scripts.

The downside is that from the UI I only get the 1 step without being able to really trace individual steps or configuring them separately with size, cache max-time etc.

Hi again!
As an update I just want to mention that in the end, I reverted the solution mentioned above to instead pass data between my steps using artifacts as per https://community.atlassian.com/t5/Bitbucket-questions/Is-there-a-way-of-sharing-data-between-steps-in-bitbucket/qaq-p/777977

In my conditional step I do the needed checks and store the result in an artifact e.g. "runTests". Then in the subsequent steps I check for if that artifact exists before continuing with the step. If it doesn't the step script is completed without having to fail. 

It's not optimal as you also point out, in that you still have the step boot up overhead but it's the only solution I've found so far. 

Thanks, that's our current solution as well, but still multiple steps are started and build minutes are used.

Truly hope Atlassian reads this.

Run into this problem as well, also ended up using artifacts.

 

It is also possible to use non-zero exit codes, like `exit 1;` - and the whole pipeline would fail, but ofc that's not always the preferred behavior.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence Cloud

🎨 Add some visual life to your templates

Hi Atlassian Community, My name is Avni Barman, and I am a Product Manager on the Confluence Cloud team. Based on feedback from you, we are giving admins more power to create templates that a...

123 views 1 4
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