Merge option is disabled and shows the warning "Successful build <required_build_name> for the latest commit" when using required builds merge check feature in Bitbucket Server

Still need help?

The Atlassian Community is here for you.

Ask the community


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

Note that this KB was created for the Data Center version of the product. Data Center KBs 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

With the Required Build option enabled in Bitbucket Server → Repository Settings, The Merge option in Pull Request is disabled and a pop-up showing the warning "Successful build <required_build_name> for the latest commit is required before this pull request can be merged" though the build is visible as successful in Build page. The build is getting triggered in Jenkins through Jenkins File.





Environment

7.21.7
Is applicable to Bitbucket Server/Datacenter 7.x and 8.x versions.

Diagnosis

  • Verify the Required Build setting in Repository Settings.
  • Verify whether Build is occurring or visible on Pull Request but still the issue is occurring.
  • Verify whether the Jenkins file holds the old legacy REST API to update Build Status.

Cause

This issue generally occurs due to the usage of Legacy Build-Status API. And need to be replaced with New Build-Status API call.

The Required builds merge check feature needs the build status to be set using this API:

New Build-status API
POST /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/builds



This newer API is used by the newer versions of the Bitbucket Server Jenkins Integration plugin. It replaces the "legacy" build-status API with New API.

Legacy Build-status API
 POST/rest/build-status/1.0/commits/{commitId}

Solution

Replacing the Legacy Build-Status API with New Build-Status API in Jenkins File to set the Build-status should resolve this issue.

Last modified on May 19, 2023

Was this helpful?

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