Bitbucket pull request widget is no longer working

The company i work for uses bitbucket cloud, my team and i switched to sonarcloud almost a year ago because of the integration with bitbucket cloud and of course the cost reduction compared to self host.

Since last friday the bitbucket pull request integration no longer works. The repository overview widget is still showing data from sonar. It seems that the widget itself is loaded but the api call to https://api.bitbucket.io/addons/sonarcloud/slug/repositories/%ID}/pullrequests/1653/code_quality returns an empty response for branchesAndPrs. I tried to re-connect sonar but that doesn’t solve anything. Is there something wrong with the bitbucket sonar integration for pull requests? I contacted bitbucket and they advised me to create a topic here.

3 Likes

Same for us. We experiencing the same issue since last week.

2 Likes

Issue seems to be the fact that the account is not the owner of the repository. If you create a pull request on a project that you own the widget loads because the underlying api call contains data. Bitbucket support is also looking at this.

Where is the support? We pay to use sonarcloud but there is no way to get support.

Hello Wesley,

We started having a look at your issue and for now we don’t know yet what’s going on. So I have a few question for you so we can try to reproduce.

Does this happen for all your PR’s ? or just a few of them ? How old are the PRs where it happens if it doesn’t happen for all of them ?

Do you have a matching PR on the SonarCloud UI ? Or could it be that the analysis didn’t create the PR on SonarCloud side ?

Does everyone have the same issue at your company or only a few people ?

Did you get anywhere with Bitbucket support ? From what I understand it could be related to user permission ? We are only checking for read permission on the repo on our side for this api call and this didn’t change in a long time.

Bitbucket support did not find anything wrong on their side. The issue happens for every pr for everyone in the company.

The situation:
bitbucket cloud
sonar cloud

there is one company workspace which is the owner of all the repositories. Every team has its own sonar cloud account which is linked to their bitbucket team account organization. The team account is the same workspace as everyone his/hers personal account (company workspace). When we manually link projects to bitbucket we use the team account.

This all worked fine till friday 26 march. The api call to retrieve the code quality no longer displays any data and therefore the widget is not shown. The strange thing is that the widget on the repository overview page is still working. We do not link our scans to bitbucket pull requests (we do short lived branch analysis) this was no issue since it apparently still linked pull request by the branch name. Since this week we do link the pull request with the required sonar scan params so we also get the nicely decorated pull request future. But this did not fix the issue we had before.

What does work is the following: if the user is the owner of the repository / workspace the widget will show on pull request and the code_quality api call contains data. But since the company is the owner of all the repositories this does not work for non personal repositories. Yeah it does sound like a permission problem but permissions has not been changed (checked with the people who manage bitbucket).

Thanks a lot for that recap of the situation. I’ll contact you privately to have some more information so that we can start digging into our logs.

One more question though, when you say:

How do you link the projects ? By importing the repository thanks to the SonarCloud UI ? Or through the repository setting in Bitbucket Cloud ?

through the repository setting in Bitbucket Cloud and this is done by logging in on the team account

Please note this issue has also been reported here:

Thanks Mark for linking this topic too.

For now we are still investigating and unable to reproduce the issue, you can keep track of our progress on this ticket: https://jira.sonarsource.com/browse/SCCOMM-55

We have identified the cause of the issue. There is a serialisation bug that only occurs for projects that have a key which includes a special character (like a . ), this made this issue a bit tricky to reproduce. We are currently preparing a fix and will keep you updated in this thread!

3 Likes

That’s great to hear. Would special character include dashes?

i don’t think it includes dashes because i created a sample project where the key contains multiple dashes which worked fine.

1 Like

Finally.

Thanks for finding this out. Yes majority of our projects has . because we use team.project naming convention in bitbucket. Hopeful this fix the issue. We currently pasting link of SonarCloud analysis for each PR we have for 3 weeks now and it’s such a pain.

1 Like

The fix is ready and we are gonna deploy it today.

The fix has been deployed, the widget should load correctly again on your PRs!
We would like to apologize again for the long waiting time, thank you for your patience with this issue.

2 Likes

i can confirm the fix works, thank you.

1 Like

Confirmed its working too on our side.

5 posts were split to a new topic: Bitbucket Cloud Pull Request widget links goes to the master branch

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.