Automatic PR Decoration with Bitbucket

Hi,
we are trying to setup the PR Decoration.
SonarQube Develop 8.0
Bitbucket v5.16.11

I managed to simulate the PR Analysis and I’m able to see the report in SonarQube.
However the findings are not decorated in Bitbucket.
I followed the setup documented here:
https://docs.sonarqube.org/8.0/analysis/pull-request/

Following Questions:

  1. Why is my PR not annotated with the findings I see in SonarQube?
  2. How can I automate the PR analysis? As of now I did configure the analysis parameter manually.
    My expectation would have been that SonarQube can match the branch analysis automatically to an PR?
    If thats not the case we alyways have to configure this manually in our pom and remove it before the merge.

Thanks for the help.

Screenshot 2020-06-10 at 10.24.53

Hi @schoepft,

To be able to understand what is happening, could you please give more information about :

  • In the PR overview in SQ, do you see a link at the top right “See the PR” ?
  • In the PR overview in SQ, do you see a warning ?
  • In the PR in BitBucket Server, do you see the SonarQube area like this :
  • Can you check your ce.log in Debug?

It’s possible with some CI and a certain version of SQ, what CI are you using to launch your analyses ?

Cheers,

Hi Aurelie,

thanks for your response.

In the logs I see some connection problems with Bitbucket!
Would have somehow expected a error in the UI in that case - therefore I didn’t check them.
Thanks for the advice!

Since we are anyhow running a branch analysis for all our branches, I hoped SQ can identify if there is an open PR or not - by using the Bitbucket API - and automatically annotate that PR with the findings.
Our CI is based on Jenkins.

I managed to get the connection through our proxy working


Screenshot 2020-06-11 at 19.01.43

I hoped that there will be some comments directly in the PR, but that seems not to be the case?

Hi @schoepft,

Good to know that it’s working now and thanks for sharing ! :slight_smile:

You need to pass specific parameters to the scanner for PR decoration.

If you upgrade to SQ 8.3, the parameters will be automatically detected for you in Jenkins, you can see more information here and maybe this thread can help you as well.

Also note that we should release SQ 8.4 around end of June and we will release a tutorial inside SQ to guide you to set up your analyses (with PR) with Jenkins.

If you are talking about issues in PR in BitBucket Server, normally they should appear in the code diff of your PR like this:

Let us know if you have any questions.

Cheers

Hi,

sorry that I didn’t provide any feedback for a long time.
It took a while to find time for this again.

We managed to pass the PR_ID to jenkins and are now triggering the PR analysis.
Analysis is working as expected and the PR is annotated.

We used the Git Source Plugin in Combination with the Jenkins Webhook for Bitbucket.
https://mohamicorp.atlassian.net/wiki/spaces/DOC/pages/210305025/Sending+URL+Parameters+to+Jenkins

Thanks a lot for your help!

1 Like

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