I use Bitbucket as a source code repository and Jenkins as a CI/CD the programming language are mostly PHP, JavaScript, CSS and YAML
When I go to my open PR in Bitbucket I see the SonarQube there:
I’m trying to run PR analysis from Jenkins but the dashboard in Sonarqube is empty and there is no source as you can see in the image below. When I click the See the PR button it redirects me to bitbucket PR.
Here is what my pipeline looks like:
stage('SonarQube PR analysis') {
agent any
environment {
SCANNER_HOME = tool 'SonarScaner-4.8'
}
tools{
nodejs 'NodeJS9'
}
steps {
script{
withSonarQubeEnv('SonarQube') {
sh "${SCANNER_HOME}/bin/sonar-scanner \
-Dsonar.projectKey=project-PR-Analysis \
-Dsonar.scm.revision=${CommitHash} \
-Dsonar.sources=src \
-Dsonar.pullrequest.key=${env.CHANGE_ID} \
-Dsonar.pullrequest.branch=${env.CHANGE_BRANCH} \
-Dsonar.pullrequest.base=master"
}
}
}
}
Here are the logs of the pipeline :
[2023-07-05T14:49:54.432Z] INFO: HTML-Dependency-Check report does not exist.
[2023-07-05T14:49:54.432Z] INFO: Process Dependency-Check report (done) | time=4ms
[2023-07-05T14:49:54.432Z] INFO: Sensor Dependency-Check [dependencycheck] (done) | time=4ms
[2023-07-05T14:49:54.432Z] INFO: Sensor Zero Coverage Sensor
[2023-07-05T14:49:54.432Z] INFO: Sensor Zero Coverage Sensor (done) | time=26ms
[2023-07-05T14:49:54.432Z] INFO: 7 files had no CPD blocks
[2023-07-05T14:49:54.432Z] INFO: Calculating CPD for 66 files
[2023-07-05T14:49:54.533Z] INFO: CPD calculation finished
[2023-07-05T14:49:54.634Z] INFO: SCM writing changed lines
[2023-07-05T14:49:54.634Z] INFO: SCM writing changed lines (done) | time=7ms
[2023-07-05T14:49:54.634Z] INFO: Analysis report generated in 84ms, dir size=210 KB
[2023-07-05T14:49:54.735Z] INFO: Analysis report compressed in 83ms, zip size=91 KB
[2023-07-05T14:49:54.735Z] INFO: Analysis report uploaded in 34ms
[2023-07-05T14:49:54.735Z] INFO: ANALYSIS SUCCESSFUL, you can browse http://sonar.company.com/dashboard?id=heracles-pimcore-PR-Analysis&pullRequest=845
[2023-07-05T14:49:54.735Z] INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
[2023-07-05T14:49:54.735Z] INFO: More about the report processing at http://sonar.company.com/api/ce/task?id=AYkmiADer5tR_kXDLLIP
[2023-07-05T14:49:54.936Z] INFO: Analysis total time: 21.807 s
[2023-07-05T14:49:54.936Z] INFO: ------------------------------------------------------------------------
[2023-07-05T14:49:54.936Z] INFO: EXECUTION SUCCESS
[2023-07-05T14:49:54.936Z] INFO: ------------------------------------------------------------------------
[2023-07-05T14:49:54.936Z] INFO: Total time: 25.140s
[2023-07-05T14:49:55.037Z] INFO: Final Memory: 26M/97M
[2023-07-05T14:49:55.037Z] INFO: ------------------------------------------------------------------------
My sonar qube version is 7.9.1 Developer Edition.