Pull Requests in Bitbucket Cloud are not creating new branches in Bamboo
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
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
Pull Requests in Bitbucket Cloud are not creating new branches in Bamboo.
Environment
- Bamboo integrated with Bitbucket Cloud through Linked Repositories, with authentication occurring through an App Password.
- In Bamboo, the Build Plan is configured to create new branches "When pull request is created".
Diagnosis
The logs in Bamboo indicate that the access is forbidden.
2021-12-09 20:29:54,119 WARN [14-PullRequestDetectionBackgroundThread:pool-21-thread-3] [PullRequestDetector] com.sun.jersey.api.client.UniformInterfaceException: GET https://api.bitbucket.org/2.0/repositories/PROJECT/REPOSITORY/pullrequests?state=OPEN returned a response status of 403 Forbidden
Cause
The App Password being used to authenticate agains Bitbucket Cloud doesn't have the "Pull Request read" permission set. Because of this, Bamboo is unable to read the pull request information, and therefore can't create branches when pull requests are performed.
Solution
Since Bitbucket Cloud App Passwords can't have their permissions edited, you'll need to create a new one, granting the required permissions, and then updating the Linked Repository information in Bamboo to use the newly created password. Please see App passwords for instructions on how to do that.