Enable/Disable merge plugin by projet/repo using bitbucket 4.x

mergecheck
plugin
plugin-development

#1

Hi,

I am currently developing a plugin for bitbucket 4.11 to ensure the branch is rebased before the pull request can be merged.

The plugin works perfectly fine, but I am not able to disable the plugin for certain projects (The plugin seems to be installed for the whole bitbucket instance which contains 20+ projects). The plugin was installed using “upload add-on”.

Here is my atlassian-plugin.xml :

    <merge-check key="IsFastFowardMergeCheck" name="is fast foward merge check" class="com.schneider.electric.bitbucket.IsFastForwardMerge">
        <description>
            Enforces that pull requests must be up-to-date with the main branch before they can be merged.
        </description>
        <icon>images/pluginIcon.png</icon>
        <scopes>
            <scope>project</scope>
            <scope>repository</scope>
        </scopes>
    </merge-check>

and the interface I am using :

import com.atlassian.bitbucket.scm.pull.MergeRequest;
import com.atlassian.bitbucket.scm.pull.MergeRequestCheck;

public class IsFastForwardMerge implements MergeRequestCheck
{
    @Override
    public void check(@Nonnull MergeRequest mergeRequest) {

Thank you,

Mathieu


#2

Hi @mathieu.marchand.ca,

The ‘scopes’ api was only added in Bitbucket Server 5.2 (see https://developer.atlassian.com/server/bitbucket/how-tos/hooks-merge-checks-guide/) so in order to use this functionality you will need to upgrade to a newer Bitbucket version.

Hope this helps,
Kristy