SonarQube Pull Request Decoration with BitBucket

Ok, I am back now.

Thank you for the Jenkins log of your Ant project. Here are the issues I see with it:

  • Earlier you mentioned that you already configured a Jenkins multibranch pipeline. Can you take a screenshot of your Jenkins configuration for Branch Sources? It should look something like this if you followed the onboarding tutorial in SonarQube:
  • Your logs show that you are manually setting the sonar.branch.name manually when you should let the Jenkins SonarQube extension handle it automatically:
    sonarcheck:
         [echo]  
         [echo] ******************************************************************
         [echo] - Executing sonarcheck
         [echo] -------------------------------------------------
         [echo] - sonar.branch.name        : PR-1773
         [echo] - sonar.extensions         : alconbackoffice,alconfacades,alconcore,alconocc,alconfulfilmentprocess,alconinitialdata,alconintegration
         [echo] - sonar.projectName        : ACE-SX-B2B
         [echo] - sonar.projectKey         : alconpc_ace-sx-b2b_AYfj_xl-fljaPvznLEc0
         [echo] - sonar.projectVersion     : 1.0
         [echo] - sonar.additionalModules  : 
         [echo] - sonar.extensions.clean   : alconbackoffice,alconfacades,alconcore,alconocc,alconfulfilmentprocess,alconinitialdata,alconintegration,
         [echo] - sonar.excludedExtensions : 
         [echo] - sonar.exclusions         : /jalo/,/constants/,/*Standalone.java,/.js,**/.css,/*.xml,/.jsp,**/.less,**/*.xsd
         [echo] - sonar.projectBaseDir     : /var/jenkins/workspace/ace-sx-b2b_PR-1773/hybris/bin
         [echo] - sonar.junit.reportPaths  : 
         [echo] - sonar.coverage.jacoco.xmlReportPaths : /var/jenkins/workspace/ace-sx-b2b_PR-1773/reports.xml
         [echo] ******************************************************************
    ...
    [sonar:sonar] Load branch configuration
    [sonar:sonar] Found manual configuration of branch/PR analysis. Skipping automatic configuration.
    [sonar:sonar] Load branch configuration (done) | time=8ms
    
  • You are using the Sonar Scanner for Ant, which is actually deprecated. After you fix your PR decoration issue, I recommend you switch over to the Sonar Scanner CLI as mentioned in this announcement “SonarScanner for Ant” is deprecated .

Here is what you need to do next:

  1. Remove any references to sonar.branch.* and sonar.pullrequest.* analysis parameters in your sonarcheck Ant task and Jenkinsfile and anywhere else you trying to set these parameters manually. Do not do that. Let the Jenkins SonarQube plugin handle that.
  2. In the Jenkins job for your project > Branch Sources section, double-check how you set Discover pull requests from forks and Specify ref specs as my screenshot above shows. You need to match what I have.

If you still have trouble, please provide the following:

  1. Your build.xml file that shows your sonarcheck task.
  2. Your Jenkinsfile
  3. Screenshot of your Branch Sources section of your Jenkins job for this project
  4. DEBUG Jenkins logs