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
プラットフォームについて: Data Center - この記事は、Data Center プラットフォームのアトラシアン製品に適用されます。
このナレッジベース記事は製品の Data Center バージョン用に作成されています。Data Center 固有ではない機能の Data Center ナレッジベースは、製品のサーバー バージョンでも動作する可能性はありますが、テストは行われていません。サーバー*製品のサポートは 2024 年 2 月 15 日に終了しました。サーバー製品を利用している場合は、アトラシアンのサーバー製品のサポート終了のお知らせページにて移行オプションをご確認ください。
*Fisheye および Crucible は除く
要約
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.
環境
7.21.7
Is applicable to Bitbucket Server/Datacenter 7.x and 8.x versions.
診断
- 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.
原因
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:
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.
POST/rest/build-status/1.0/commits/{commitId}
ソリューション
Replacing the Legacy Build-Status API with New Build-Status API in Jenkins File to set the Build-status should resolve this issue.