Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

URGENT: Not able to see such branch permission as mentioned on bitbucket support docs online

Hi,

I am not able to see below such options in branch permission as mentioned in 

  1.  https://support.atlassian.com/bitbucket-cloud/docs/use-branch-permissions/
  2.  https://community.atlassian.com/t5/Bitbucket-questions/How-to-prevent-a-merge-when-one-or-more-build-in-pipeline-failed/qaq-p/907393

I am able to see somewhat different and due to that I am not able to have/put merge checks on specific branch for failed builds. I am able to see only the below options under branch permission. 

Please help me out :(Capture.PNG

2 answers

0 votes
Mikael Sandberg Community Leader Apr 12, 2021

Hi @Rahul,

Welcome to Atlassian Community!

The documentation you are linking to only applies to Bitbucket Cloud, and based on your screenshot it looks like you are on Bitbucket Server/Data Center. Here is the link to branch permissions on Server/DC, https://confluence.atlassian.com/bitbucketserver/using-branch-permissions-776639807.html

Hi @Mikael Sandberg . Thanks for your quick response :)  I really appreciate it. But the link you provided doesn't fulfill my requirement.

Let me explain to you the need and it would be great if you can help me out since its really urgent:

I have a webhook in bitbucket and I am using that to trigger a Jenkins build whenever I get a Pull request in the master branch.

Till here it's working.

Now I want, if the build fails, I simply want to close that merge option in bitbucket, or simply I want that merge option to be disabled for that Pull Request i.e., the merge for the master branch will be allowed only when the build succeeds and if the build fails, merge option to master branch is disabled/closed. (only merging to the master is to be noticed)

The links provided in the Atlassian community for this use case are for Bitbucket cloud and I am unable to get any documentation for this use case for server/DC.

please help :)

Mikael Sandberg Community Leader Apr 13, 2021

Okay, so you need to configure your merge checks to only allow a merge to happen if you have at least one successful build. In Jenkins you have to use the Bitbucket build status notifier plugin in order to control this. Once you start a build it will notify Bitbucket that a build is in progress, and once finished it will notify that the build is successful or not. You can find more information about merge checks here, Checks for merging pull requests.

Hi @Mikael Sandberg . I really appreciate your valuable time.

I have used that Bitbucket build status plugin and it, in fact, sends the status of the build (either success/fail) to Bitbucket but the problem is the merge checks doc you sent me (https://confluence.atlassian.com/bitbucketserver/checks-for-merging-pull-requests-776640039.html)  gets applied to all the pull requests to all branches.

for example, suppose if we have 5 branches and this merge check should happen only to the master branch, and the rest 4 branches(each given to separate developers) are free to create a Pull request and merge freely among themselves

So concluding it " I want a branch-level merge check like this https://community.atlassian.com/t5/Bitbucket-questions/How-to-prevent-a-merge-when-one-or-more-build-in-pipeline-failed/qaq-p/907393 ". Exactly this same thing I want in my bitbucket server.

I hope you got my use case now.

It's great to find such people like you who are nurturing the wonderful community. Cheers :)

Mikael Sandberg Community Leader Apr 13, 2021

Are you doing builds on the other branches too and report the build back to Bitbucket? If not then you are good. At my previous job we were doing builds on the integration branch with the merge checks enabled for 1 successful build and that all tasks had to be completed. But we had other feature branches too, but since we did not do builds on those, or if we did, it was not reported back to Bitbucket then those merge checks are ignored.

Like Rahul likes this

Hi @Mikael Sandberg 

Correct, you guessed it right. I am not doing the build on the other branches and report the build back to Bitbucket.

Its just the master branch when getting a Pull Request triggers a build to the Jenkins job via a webhook and Jenkins sends back the build status. (Its working till here)

Now, I just want a check on the Master branch only that if the build is successful, allow merging (merge button enabled) and if the build fails(that Pull Request would not be allowed to merge).

Now I have an option for minimum successful build (you can refer to the screenshot below)- but this option is useless as this option is at repository level and nothing is related to branch in this. I want this for the branch level.

That means apart from merging into the master branch, feature branches also require to pass the builds but even though there is no Jenkins job triggered for them as Bitbucket requires one successful build to merge and simply the PR merging is not allowed as this option requires a minimum of 1 build to merge- so this option is useless for me.

Capture.PNG

So  I want this above option (screenshot one) to be assigned just to the master branch and not to the entire repository level.

So concluding it " I want a branch-level merge check like this https://community.atlassian.com/t5/Bitbucket-questions/How-to-prevent-a-merge-when-one-or-more-build-in-pipeline-failed/qaq-p/907393 ". Exactly this same thing I want in my bitbucket server.

 

Kindly see my request as I have been stuck here for many days and I am unable to find any documentation for this. Do I need to buy some plugins for Bitbucket or it is just possible in Bitbucket cloud and not in the Bitbucket server/DC?

Mikael Sandberg Community Leader Apr 14, 2021

No, you are getting the merge checks wrong. Take the minimum successful builds for example, this is based on a setting on the pull request. This setting can have inProgress, successful or failed. But if a commit that is part of the pull request do not have this value set the merge check is ignored. Same thing applies to the completed task check. If your pull request do not have any tasks, this check is also ignored. The only merge check that is never ignored is the number of approvers needed.

Hi @Mikael Sandberg can you please tell me the steps in order to achieve my use case. I am not able to get your point. 

I want to put a merge check according to Jenkins build(success/failure) on master branch(branch level)  and not on repository level in bitbucket server.

Because the option which I can see is for repo level.

Mikael Sandberg Community Leader Apr 14, 2021

So in the repository enable the merge check for successful builds, that will cover your use case. The merge check will only be in play on your master branch and will be ignored on your other branches.

@Mikael Sandberg 

No Mikael, It is not ignoring rest of the branches. That's the problem. 

It requires successful build for merging rest branches too (other than master branch also). Because in "merge check for successful builds" doesn't takes any branch name as input parameter and it gets applied to all the branches implicitly. Capture.PNG

Now see in the below screenshot I am merging two branches(one branch name is rahul and other branch name is kumar) and master branch is not involved even though Bitbucket needs a successful build and merge check is applied to them as well but I want merge check just for master branch on the basis of Jenkins build.

Capture.PNG

 

If possible can you please join https://fico.zoom.us/my/rahul . It will hardly take 5-10 minutes, its a request please :)

Mikael Sandberg Community Leader Apr 14, 2021

Looks like the definition has changed for the merge check then. But I found this free app that works around that by adding a merge veto option if the build fails for a specific branch.

No @Mikael Sandberg . it does not solve my use case. This is different from what my use case is.

It says "Allows to monitor the build staus of code which would be in target branch after real Pull-Request merge and veto the merge if build is failed". It's  when after the PR is merged.

Don't we have any sort of Bitbucket's functionality which can fulfill my need? 

Is this not possible in Bitbucket?

Mikael Sandberg Community Leader Apr 14, 2021

So why would the app not solve your issue? You want to make sure that what you are about to merge doesn’t break anything on your main branch correct? And by default Bitbucket would not allow you to merge anything unless the source branch is up to date with the target branch. So when you do the build in Jenkins you are actually doing a build on what would be the code on the target branch. Are you doing a pre-build on the source branch even before creating a pull request to merge to main? 

@Mikael Sandberg 

I am really helpless, kindly me out.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

Calling any interview participants for Bitbucket Data Center

Hi everyone,  We are looking to learn more about development teams’ workflows and pain points, especially around DevOps, integrations, administration, scale, security, and the related challeng...

639 views 7 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