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

Controlling the "Merge" button via automation

Zvika Castel July 31, 2021

hi,

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
Ulrich Kuhnhardt _IzymesCo_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
August 1, 2021

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?

[1] https://confluence.atlassian.com/bitbucketserver/checks-for-merging-pull-requests-776640039.html

Zvika Castel August 2, 2021

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
TAGS
AUG Leaders

Atlassian Community Events