I added "Commit status publisher" build feature to Teamcity build configuration and I see successful builds on the "builds" tab in pullrequest.
However, if I set some required builds for pull requests, bitbucket shows issue that prevents merging PR "Successful build of {build id} for the latest commit is required before this pull request can be merged."
What build ID should I specify when integrating with Teamcity? I have set "Build configuration ID" option from the Teamcity.
I got the same build keys when running the command:
curl -u {user}:{pass} https://{bitbucket_server}/rest/build-status/1.0/commits/{commit_hash}
Hi @Loh
The reason that required builds merge check is not automatically suggesting the key of the builds is that you may be using a plugin/feature in Teamcity that sends build details via the old endpoint. Not all plugins use the new endpoint to update the build status in Bitbucket, which means the necessary details such as parent, ref for this feature to work are not sent by those plugins. Consequently, the feature does not function in these situations.
Old Endpoint(deprecated): /rest/build-status/1.0/commits/<commit-hash>/builds
New Endpoint : /rest/api/latest/projects/<projectKey>/repos/<repositorySlug>/commits/<commitId>/builds
We have indicated in the Required Builds Merge Check article that this feature only functions with Bamboo 7.1+ or the Bitbucket Integration Plugin version 2.0.0+ the reason is that these tools use the newer endpoint. However, it can also work with any third-party plugin that uses the new endpoint.
I want to clarify that the build key you obtain from the endpoint "https://{bitbucket_server}/rest/build-status/1.0/commits/{commit_hash}" does not correspond directly to the key that Bitbucket shows on the required builds page. Instead, the build key displayed by Bitbucket is derived from the parent field in the build result response. Although they are often the same, they can differ. I can provide an example from my local setup to demonstrate the difference.
Ensure that your CI/CD system uses the newer endpoint so it populates all the relevant data and whatever value it is sending in the parent field is what you can define in required builds page.
Regards,
Aman
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.