Bitbucket pipelines - Logic OR multiple pipeline start conditions

Cezar Chirila
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!
March 28, 2023

Hi!

Is it possible to logic OR two different start conditions? 

In our case, we want to start a pipeline whenever a commit has been made to the master branch OR when a pull request has been raised. We currently do this by having two separate pipeline start conditions as follows: 

pipelines:

branches:

master:

"STEPS TO BUILD AND TEST HERE"

pull-requests:

'**':

"STEPS TO BUILD AND TEST HERE"

However, this causes us to have two "STEPS TO BUILD AND TEST HERE" blocks which are the same and we would like to do something like:

pipelines:

branches:

master:

pull-requests:

'**':

"STEPS TO BUILD AND TEST HERE"

Would this be possible by any current means, or maybe is there a single trigger that could capture both conditions?

Thank you!

1 answer

1 accepted

1 vote
Answer accepted
Aron Gombas _Midori_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 28, 2023

I don't know about an OR operator, but I think there is a better solution to the problem. 

You could define your steps with YAML anchor, then refer to that anchor in both locations.

See: https://support.atlassian.com/bitbucket-cloud/docs/yaml-anchors/

Cezar Chirila
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!
March 28, 2023

Thanks you, this is what I was looking for!

Like Aron Gombas _Midori_ likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events