Bitbucket Server Pull Request Decoration not working with SonarQube Developer Edition

The environment details:

  • SonarQube Developer Edition v7.9.1

  • Atlassian Bitbucket Server version: v6.10.1

  • SonarCFamily Plugin version 6.5.0 (build 12506)

Scanner environment details:

  • Operating system: Microsoft Windows Server 2012 R2

  • SonarScanner-v4.2.0.1873

Problem statement: Stash/Bitbucket notification skipped. The Pull Request decoration is not happening. It is not clear which property is missing.

Scanner logs: Last few lines….

10:18:25.702 DEBUG: **'Stash/Bitbucket notification' skipped because one of the required properties is missing'**

10:18:25.704 DEBUG: Post-jobs :

10:18:26.033 INFO: Analysis total time: 16.254 s

10:18:26.071 INFO: ------------------------------------------------------------------------


10:18:26.072 INFO: ------------------------------------------------------------------------

10:18:26.072 INFO: Total time: 19.953s

10:18:26.174 INFO: Final Memory: 17M/108M

10:18:26.174 INFO: ------------------------------------------------------------------------

Steps to reproduce

Sonar properties:

  • Global SonarQube=>Administration=>General Settings=>Pull Requests=>
sonar.pullrequest.provider = Bitbucket Server
sonar.pullrequest.bitbucketserver.serverUrl = <our bitbucket server URL>
sonar.pullrequest.bitbucketserver.token.secured = <a valid personal access token from Bitbucket server that has write access to the repository>
  • Project level SonarQube=>Administration=>General Settings=>Pull Requests=>
sonar.pullrequest.bitbucketserver.project = my_bitbucket_projectkey
sonar.pullrequest.bitbucketserver.repository = sonarqube
  • file<url of the sonarqube server>
sonar.projectName=Example of C/C++ Scan (with BuildWrapper)
sonar.login=<sonar login token>
  • Sonar-Scanner command execution:
C:\sqscanner\SonarScanner-v4.2.0.1873\build-wrapper-win-x86-64 --out-dir build_wrapper_output_directory build.bat

And then

C:\sqscanner\SonarScanner-v4.2.0.1873\bin\sonar-scanner -X -Dsonar.projectVersion=1.0.2 -Dsonar.pullrequest.key=7 -Dsonar.pullrequest.branch=sqpr -Dsonar.pullrequest.base=develop

This message refers to the mibexsoftware/sonar-bitbucket-plugin, not the native integration with Bitbucket Server provided by SonarQube v7.9 that is described in the documentation on Pull Request Analysis. Let’s ignore that for now.

Does a Pull Request show up when you browse your SonarQube Project?

Do any warnings appear?

Screenshot 2020-04-09 at 15.27.41

Yes. It does. I can also see a hyperlink to the PR at top-right of SonarQube dashboard.

Indeed the Pull Request shows up. It also shows a hyperlink to the pull request at Bitbucket server. However, there are no warnings.

Any leads on the issue we are facing?

What do you see when you open the PR link from SonarQube? You should see something like this that you can click on for more details.

It doesn’t look like the PR raised any issues (at least from what I can see of the screenshot shared), so I wouldn’t expect there to be any in-line issues on the Bitbucket side.

We can reach the PR page after clicking the PR link from SonarQube. But we miss the SonarQube information on the Pull Request at the Bitbucket side.

It looks like we’re dealing with quite some old PR analyses (the PR you shared a screenshot of is from April 3rd, while the SonarQube analysis was done on… March 26th?)

How about a fresh PR build/analysis?

If that doesn’t help, I’d recommend…

  • raising your log level to TRACE level (Global Administration > System > Log Level),
  • triggere an analysis you expect to result in PR Decoration and wait for the PR to be visible in SonarQube
  • changing your log level back to INFO level
  • attach the ce.log file from your logs directory

After much investigation we found that we were using all the properties correctly yet the decoration was not happening. However, due to an unconnected issue we had to restart our Bitbucket Server’s reverse proxy that has resolved the PR decoration issue too. Guess the proxy was blocking the passage of the decorator.

Thank you very much for your time on this issue, Colin.

1 Like

It seems you did the heavy lifting! Glad it’s sorted out for you now. Happy PR Decorating. :slight_smile:

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