Upgrade to Bitbucket Server 8.0

This page describes how to migrate from Bitbucket Server 7.x to 8.0. Release 6.52.0 is the first release that is compatible with Bitbucket Server 8.0 onwards.

If you have any issues please contact us via our Service Desk.

This page is split up into a suggested upgrade procedure, and the possible areas you will need to change.

At the time of writing, the official page explaining the upgrade procedure is here which we recommend you read before upgrading.

How to Upgrade

First you should create a clone of your production system that you can do a practice upgrade on. There is an Atlassian knowledge base article about creating a staging system here.

Once you have the staging system created, upgrade it to Bitbucket Server 8. Then install the ScriptRunner plugin.

The static type checker available in ScriptRunner for Bitbucket Server should be able to indicate problems quite quickly.

You should open each admin page that lists each extension point, eg pre-receive hooks, listeners etc. Look for code highlighted with red errors, and fix them

The condition script is not currently shown in the overview page, so click edit for each listener or hook etc, and check that the condition shows the green dot of successful compilation.


If practical, test your most important scripts and conditions in your staging server.

Production Upgrade

Finally, make sure that your maintenance window includes enough time to do your production upgrade, and then the modifications to the scripts that you have already tested in your staging server.

Areas of Change

You may need to update your scripts and conditions, as some of the APIs that were marked as deprecated in Bitbucket Server 7 have now been removed. Full details of which classes, interfaces and methods have been removed can be found here.

This is not a definitive list, however, these are the changes we think you are most likely to have to make to your scripts.

Replacing StringCommandOutputHandler

With Bitbucket 8, the CommandOutputHandler interface has changed. This will affect any of your existing output handlers used in your scripts that execute git scm commands, like for example `StringCommandOutputHandler`.

You should edit these scripts and use another output handler like SingleLineOutputHandler.

Replacing BuildStatusService

BuildStatusService has been removed in Bitbucket 8, so if you are using it in your scripts, you will need to use RepositoryBuildStatusService instead.

For example the following script:

import com.atlassian.bitbucket.build.BuildStatusService
import com.onresolve.scriptrunner.runner.customisers.PluginModule

BuildStatusService buildStatusService


could be replaced with something like this:

import com.atlassian.bitbucket.build.status.BuildStatusRepositorySearchRequest
import com.atlassian.bitbucket.build.status.RepositoryBuildStatusService
import com.atlassian.bitbucket.repository.RepositoryService
import com.atlassian.bitbucket.util.PageRequestImpl
import com.atlassian.sal.api.component.ComponentLocator
import com.onresolve.scriptrunner.runner.customisers.PluginModule

def repService = ComponentLocator.getComponent(RepositoryService)

def repo = repService.getBySlug('PROJECT_1', 'rep_1')

RepositoryBuildStatusService repositoryBuildStatusService

    new BuildStatusRepositorySearchRequest.Builder(repo).build(),
    new PageRequestImpl(0, 100)

Replacing HookResponse

With Bitbucket 8, com.atlassian.bitbucket.hook.HookResponse has been removed and you will not be able to use it. This might affect existing pre-hook or post-hook scripts. You should edit these scripts and replace HookResponse with HookResponseAdapter.

For example the following script:

import com.atlassian.bitbucket.hook.HookResponse

HookResponse hookResponse = hookResponse

hookResponse.out().print("You cannot commit at the moment.")

Could be replaced with something like this:

import com.onresolve.scriptrunner.bitbucket.HookResponseAdapter

HookResponseAdapter hookResponse = hookResponse

hookResponse.out().print("You cannot commit at the moment.")

On this page