Unable to merge a pull request when using the Required Builds merge check in Bitbucket Data Center

Still need help?

The Atlassian Community is here for you.

Ask the community


Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.

Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

    

Summary

After configuring Required Builds on a repository, pull requests can't be merged despite having a successful build.

Environment

Bitbucket Data Center 7.14 or higher

Diagnosis

The following are symptoms when a pull request can't be merged while using the Required Builds merge check:

  • The bb_build_status table is empty.
  • New build statuses go to the AO_CFE8FA_BUILD_STATUS table
  • The file located at $BITBUCKET_HOME/shared/config/upgrades/core-builds-ao-mig contains STEP1_ASYNC_LIQUIBASE_MIGRATION
  • The asyncdblock table contains a record with locked=true and lockgranted is way past the current date

Cause

The Required Builds merge check was introduced in 7.14.  To take advantage of this feature, build statuses need to be stored in the bb_build_status table.

Customers who have upgraded to version 7.4 or higher will have their build statuses migrated from AO_CFE8FA_BUILD_STATUS to bb_build_status.

When this migration fails or is incomplete, the Required Builds can't be used.


Solution

How do I resume the migration?

  1. Stop all Bitbucket nodes
  2. Delete the row in the asyncdblock table
  3. Start Bitbucket
  4. Monitor the progress of the migration using the following methods:
    • Check the JMX bean AsyncMigrationUpgrade for the status of the migration task

    • Run the following query to return the number of records remaining to be processed. A value of 0 means that the migration is complete.

      select count(*) from "AO_CFE8FA_BUILD_STATUS" where "ID" >= (select cast(prop_value as integer) from app_property where prop_key = 'build.status.migration.max.ao.id');
    • A complete migration will be indicated by a value of DONE in $BITBUCKET_HOME/shared/config/upgrades/core-builds-ao-mig


Once the migration is complete, new build statuses will be stored in the bb_build_status table and the Required Builds can be used. 

If the migration has been completed, but records still go to AO_CFE8FA_BUILD_STATUS, check the REST endpoint used to post the build status.


Last modified on Dec 16, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.