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

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

Avatar

1 badge earned

Collect

Participate in fun challenges

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

Challenges
Coins

Gift kudos to your peers

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

Recognition
Ribbon

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!

Leaderboard

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
4,464,351
Community Members
 
Community Events
176
Community Groups

Merge a PR on a conditional check

Hello Team,

We'd need to know how we can put a condition with a PR while merging this to the main branch ; so for some PRs I have 2 successful build required but for some of them I need only one green build ; How can I achieve that flexibility?

Thanks,

R..

2 answers

1 accepted

1 vote
Answer accepted
Patrik S Atlassian Team May 03, 2022

Hello @Raktim ,

Welcome to Atlassian Community!

You can configure the merge checks by setting up  Branch permissions in your repository, where , among other possible checks,  you can define the number of successful builds required before merging to a given branch/branch pattern.

You can get more details about branch permissions in the following documentation:

However, since the merge checks in the branch permissions are configured from the pull request's destination branch perspective, and you mentioned your pull request are both merging to main branch, I'm afraid it would not be possible to configure two different rules for main branch, one requiring 1 successful build and the other 2 successful build, as Bitbucket would not be able to know when to apply one rule or another.

The only way current way to achieve different number of required successful builds would be if you were merging to different branches, so you could have one branch permissions setup for each of the destination branches.

Hope that helps to clarify your questions.

Thank you, @Raktim .

Kind regards,

Patrik S

Thanks for clarifying @Patrik S - I understand that @Raktim may have 2 different _source_ branches both merging to main branch. Say we have PRs from bugfix/abc to main require 1 successful build and PRs from feature/xyz require 2 successful builds.

Can you confirm, @Raktim 

If that's the use case  - Workzone for BB Cloud is an app you can use to define such conditions.

workzone successful builds.png

The screenshot doesn't exactly show the number of required builds, but the configs have 2 and 1 required build respectively.

Disclaimer: Izymes just released Workzone Cloud (free) to the MP - let me know if you need any help setting it up.

Hey @Ulrich Kuhnhardt _IzymesCo_ 

yes that was exactly what I wanted ; but let's say we want to configure that so that it works every time . How do I tell BB if for PR 1 is different from Pr 2 ? So I need to use some commit message or branch names ? 

@Raktim - you can differentiate by specifying the source branch and the destination branch in Workzone settings. The required number of successful build will be checked for every PR from the source to destination branch.

Changing the required number of build dynamically when you create the PR (just like adding reviewers) isn't possible AFAIK.

0 votes

As far as I know required build results can only be set to an absolute number in Bitbucket cloud.

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events