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
Community Members
Community Events
Community Groups

Controlling the "Merge" button via automation


At first, just to make sure, we use BitBucket server version 7.6.0

I need to disable the "merge" button via Jenkins automation on a PR open.
this is because as long as the build is not successful, the merge button must be disabled.

The disable action is easy. but...
at the end of successful build, I can't enable the merge button because I can't tell if all other conditions of the merge button are met, like # of approvals.

any idea how/if can I get this info from the merge button ?


1 answer

0 votes

Bitbucket server project or repo settings let you define merge conditions, including the number of successful builds required. If the condition is not met, the merge button should be disabled.

Internally Bitbucket performs all merge-checks [1] sequentially and if one or more fail the PR can't be merged, i.e. the merge-button is disabled.

Can you elaborate a bit more on how you use Jenkins automation? Are you developing your own app/add-on?


although this algorithm is not bullet proof...

PR open triggers a Jenkins job to perform a build, and, in addition to other merge-checks, the build must be successful. but BitBucket's merge-check is on # of successful build(s) and I need the last build to be successful, not just any # of builds, so I ca't use this merge-check, meaning I have to take care of the "Enable merge button' at the end of the build by myself via kind of BitBucket's automation command.

but I can't do this unless all other merge-checks are already done.

this is the info I want to get from BitBucket - are there any uncompleted merge-checkes ?


Atlassian could solve this situation by add a merge-check for the last build.

Suggest an answer

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

Git push size limits are coming to Bitbucket Cloud starting April 4th, 2022

Beginning on April 4th, we will be implementing push limits. This means that your push cannot be completed if it is over 3.5 GB. If you do attempt to complete a push that is over 3.5 GB, it will fail...

2,170 views 2 9
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