Bitbucket Server PR Decoration Help

We are using SonarQube 7.9.1 and Bitbucket Server v6.6.1
I have set up PR Decoration according to the docs on https://docs.sonarqube.org/latest/analysis/pull-request/ and my PRs are not being decorated on new builds. I have looked in the Sonar logs and do not see any relevant errors/messages related to PR decoration. How can I troubleshoot this further?

Can you please confirm a few things:

  • Are the PRs getting analyzed? (Do you see them on SonarQube?)
  • When you look at a PR on SonarQube:
    • do you see the link to the PR in the top-right corner?
    • do you see a warning box (in yellowish background) in the top-right corner?
  • Is the project you’re analyzing in a personal space or not?
  • Are you sure the Bitbucket user whose access token you configured on SonarQube has the correct permissions to decorate PRs?

@janos,

Sorry for the late reply. It took me a while to get this setup for a test. We have since upgraded to Sonar * 8.3.1 and * Bitbucket v6.8.0

Are the PRs getting analyzed? (Do you see them on SonarQube?)

Yes, I see the Pull Request Analysis in SQ

do you see the link to the PR in the top-right corner?

No

do you see a warning box (in yellowish background) in the top-right corner?

Yes

Is the project you’re analyzing in a personal space or not?

I’m not sure how to check this, but I don’t think we have any personal spaces

Are you sure the Bitbucket user whose access token you configured on SonarQube has the correct permissions to decorate PRs?

I’m pretty sure I have this set up correctly. The URL and PAT are set. I had our IT guy generate a token from a user that has admin privs on BitBucket.

Here are some log entries from our compute logs:
2020.07.02 13:31:02 INFO ce[AXMPuSoDr5ytBFOtlI7x][o.s.c.t.p.a.p.PostProjectAnalysisTasksExecutor] Webhooks | globalWebhooks=0 | projectWebhooks=0 | status=SUCCESS | time=5ms
2020.07.02 13:31:02 WARN ce[AXMPuSoDr5ytBFOtlI7x][c.s.C.D.A.F] Pull request decoration did not happen. Failed to access Bitbucket Server, the repository or the pull request: Unable to contact Bitbucket server
2020.07.02 13:31:02 INFO ce[AXMPuSoDr5ytBFOtlI7x][o.s.c.t.p.a.p.PostProjectAnalysisTasksExecutor] Pull Request decoration | status=SUCCESS | time=70ms
2020.07.02 13:31:02 INFO ce[AXMPuSoDr5ytBFOtlI7x][o.s.c.t.CeWorkerImpl] Executed task | project=com.edlogics:edlogics-platform | type=REPORT | pullRequest=7928 | id=AXMPuSoDr5ytBFOtlI7x | submitter=sonar | status=SUCCESS | time=1687ms

Hi @csavory,

Could you turn the ce.log in DEBUG and see what happens when a PR is analysed?

Also could you please check that:

  • The pull request key is correct and matches the pull request ID in the BB server
  • The repository slug is correctly configured in the pull request decoration settings under the project’s administration.

Cheers

@aurelie,

Thank you for the prompt reply.

Here is the URL of my PR in BB:
https://bitbucket.edlogics.com/projects/STASH-ED/repos/elrc/pull-requests/7928/overview

Here is the Sonar URL:
https://sonar.edlogics.com/dashboard?id=com.edlogics%3Aedlogics-platform&pullRequest=7928

Here is the Sonar Project Config:

So it looks like Sonar is getting the Key, SLUG and PRID correct. right?

I turned on Debug logging and I have attached the log sonarqube_ce (2).log (101.0 KB) file.

Looks like it is an SSL Cert issue? What could be causing that?

@csavory,

Thanks for the links but seems like I need user/pwd to connect to your instances :slight_smile:

Yes they are correct, seeing the url of your repo

Maybe you could have a look at this thread if you find anything interesting, otherwise, let us know and we will investigate.

Cheers

1 Like

@aurelie that thread helped. We were able to fix the issue by upgrading Java and one of our outdated plugins.

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