Skip to main content
Skip table of contents

How to migrate the merge settings for 3.x to 4.x?


Due to a refactoring in from the major release 3.x to the major release 4.x, the merge hook got a new hook key: com.lb.software.stash.jira.connector.lb-software-stash-jira-connector:lb-software-stash-jira-connector-issue-key-merge. This is the reason, why Bitbucket can not find the already configured 3.x settings in the 4.x merge hook. But the hook settings are still available. This article describes how to migrate the settings of the merge hook.


The migration can be done via the REST-API of Bitbucket. The REST-API offers a interface which enables you to get the settings of the old hook as JSON. This JSON settings you can push back to the new hook. (link)

Example

Description of the examples:

  • com.lb.software.stash.jira.connector.lb-software-stash-jira-connector:lb-software-stash-jira-connector-issue-key - Old hook key
  • com.lb.software.stash.jira.connector.lb-software-stash-jira-connector:lb-software-stash-jira-connector-issue-key-merge - New hook key
  • PROJECT_1 - The slug of the project in this example
  • rep_1  - The slug of the test repository in  this example
  • admin:admin - username and password to access the settings via REST-API
  • http://bitbucket:7990/bitbucket - The URL of the Bitbucket instance



How to get the existing 3.x settings

This example shows how to get the 3.x settings of the repository "rep_1" in the project "PROJECT_1" via the tool curl from the hook key "com.lb.software.stash.jira.connector.lb-software-stash-jira-connector:lb-software-stash-jira-connector-issue-key"


BASH
curl -i -H "Accept: application/json" -H "Content-Type: application/json" -X GET http://admin:admin@bitbucket:7990/bitbucket/rest/api/1.0/projects/PROJECT_1/repos/rep_1/settings/hooks/com.lb.software.stash.jira.connector.lb-software-stash-jira-connector:lb-software-stash-jira-connector-issue-key/settings


The result:

CODE
{"mergeTextSyntaxCheckRegEx":"","mergeTextSyntaxCheckMessage":"","mergeCheckIssueStatusCheckEnabled":true,"mergeTextIssueStatusCheckRegEx":"To Do|Done|Fertig|Aufgaben","mergeTextIssueStatusCheckMessage":"","mergeCheckIssueKeyNeeded":true,"mergeCheckIssueKeyRegEx":"","mergeTextJQLQuery":"","mergeTextJQLQueryMessage":"","mergeTextBranchCheckRegEx":"","mergeCheckExceptionGroupEnabled":true,"mergeTextExceptionGroup":"admin"}

How to put the JSON Settings back to the 4.x hook

This example shows how to put the 3.x settings to the 4.x hook. The settings will be put to the repository "rep_1" in the project "PROJECT_1" via the tool curl. Note: See the different hook key ending  "com.lb.software.stash.jira.connector.lb-software-stash-jira-connector:lb-software-stash-jira-connector-issue-key-merge"


BASH
curl -H 'Content-Type: application/json' -X PUT -d '{"mergeTextSyntaxCheckRegEx":"","mergeTextSyntaxCheckMessage":"","mergeCheckIssueStatusCheckEnabled":true,"mergeTextIssueStatusCheckRegEx":"To Do|Done|Fertig|Aufgaben","mergeTextIssueStatusCheckMessage":"","mergeCheckIssueKeyNeeded":true,"mergeCheckIssueKeyRegEx":"","mergeTextJQLQuery":"","mergeTextJQLQueryMessage":"","mergeTextBranchCheckRegEx":"","mergeCheckExceptionGroupEnabled":true,"mergeTextExceptionGroup":"admin"}' http://admin:admin@bitbucket:7990/bitbucket/rest/api/1.0/projects/PROJECT_1/repos/rep_1/settings/hooks/com.lb.software.stash.jira.connector.lb-software-stash-jira-connector:lb-software-stash-jira-connector-issue-key-merge/settings 


How to put the JSON Settings back to the 4.x hook and enable the hook

If you plan to enable the hook you just need to use a different URL use enabled instead of settings.


BASH
curl -H 'Content-Type: application/json' -X PUT -d '{"mergeTextSyntaxCheckRegEx":"","mergeTextSyntaxCheckMessage":"","mergeCheckIssueStatusCheckEnabled":true,"mergeTextIssueStatusCheckRegEx":"To Do|Done|Fertig|Aufgaben","mergeTextIssueStatusCheckMessage":"","mergeCheckIssueKeyNeeded":true,"mergeCheckIssueKeyRegEx":"","mergeTextJQLQuery":"","mergeTextJQLQueryMessage":"","mergeTextBranchCheckRegEx":"","mergeCheckExceptionGroupEnabled":true,"mergeTextExceptionGroup":"admin"}' http://admin:admin@bitbucket:7990/bitbucket/rest/api/1.0/projects/PROJECT_1/repos/rep_1/settings/hooks/com.lb.software.stash.jira.connector.lb-software-stash-jira-connector:lb-software-stash-jira-connector-issue-key-merge/enabled



JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.