PR analysis on BitBucket Server?

Hi Ann,

I saw that in the documentation for the latest 7.6 release, the Pull Request Analysis does not include Bitbucket as a sonar.pullrequest.provider. Any updates regarding this feature? It’s now supported for the on-premise version?
Thank you.

Kind regards,
Alex

Hi Alex,

I’ve split this from the 5-month-old version release announcement you posted it on to a new thread, since it’s really not related to that old announcement.

We anticipate releasing SonarQube 7.7 with support for BitBucket Server.

 
Ann

1 Like

Yes, make more sense to have it here.

Thank you for the update.

Alex

Hi Ann,

I read though the posts and it seams that this feature has been implemented in release 7.7.
Can you please provide a working config for this?

I read the documentation but somethings are not clear, for example:

  • with the new release are the PRs decorated alongside the analysis run ?
  • regarding sonar.pullrequest.bitbucketserver.token.secured what is actually needed ? and how to obtain it from Bitbucket cloud ?

A small example will provide more clarity.

Thank you and looking forward to your response.

Kind regards,

Hi Alexandru,

You can check out the documentation on generating your personal access token on BitBucket Server here. You need to make sure the account that you’re using to decorate your PRs has write permission.

Hope this helps!

Mike

Hi Alexandru,

I am a SonarQube user, currently with SonarQube 7.7 Developer Edition and have PR analysis working with Bitbucket Server 6.3.0. First, you need to have Bitbucket Server 5.15 or greater for PR decoration as the the PR integration uses the Bitbucket Insights API.

In SonarQube Server, go to Administration → General Settings → Pull Requests, set provider to Bitbucket Server and access token

In my sonar-project.properties, I have:
sonar.pullrequest.bitbucketserver.project=PROJ
sonar.pullrequest.bitbucketserver.repository=MYREPO
sonar.projectVersion=${buildVersion}
sonar.pullrequest.branch=${buildGitBranch}
sonar.pullrequest.key=${buildPullRequestId}
sonar.pullrequest.base=${buildPullRequestTargetBranch}

I run this through Jenkins CI (with SonarQube gating) and works great.

Let me know if I can help.

–Mark

Thank you both for the support!

I just have another question regarding Bitbucket cloud, as it seams that the authentication mechanism requires an access_token (personal access token).
I looked for this in Bitbucket cloud and it seams that they offer “App passwords” instead.
@scmbuildguy Will this work in Sonarqube as a secured token?

Thank you,

Is this working with sonarqube version 6.7.1?

I use Bitbucket server 6.3.0, not Bitbucket Cloud, however, it should work if it has write credentials to the project/repo.

–Mark

Hi Nicolae,

Bitbucket Server PR decoration is available in SonarQube 7.7. For all release notes, visit https://www.sonarqube.org/whats-new/ and review documentation at https://docs.sonarqube.org/latest/.

–Mark

3 Likes

A post was split to a new topic: Bitbucket PR analysis empty