Must-share information (formatted with Markdown):
- which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
I am using Community Edition - Version 9.0.1 (build 46107) ,
sonarqube scanner plugin jenkins 2.14
- what are you trying to achieve
I have a step in Jenkins for sonarqube integration and it works but the builds are taking nearly 30mins each time.
My setup is Jenkins and Sonarqube deployed into Kubernetes using helm.
I’m thinking the issue is to do with caching.
- what have you tried so far to achieve this
I’ve created a PV and PVC using azure file share and mounted that into the maven docker container that triggers the MVN sonar:sonar step.
I can see that the files are in the Azure file share.
but when I re-run the pipeline it analyze all 195 files again.
[INFO] 195 source files to be analyzed
[INFO] Load project repositories
[INFO] Load project repositories (done) | time=33ms
[INFO] 0/195 files analyzed, current file: apiserver/src/main/java/file-----.java
[INFO] 1/195 file analyzed, current file: apiserver/src/main/java/file-----.java
[INFO] 3/195 files analyzed, current file: apiserver/src/main/java/file3-----.java
...........
..........
[INFO] 195/195 files analyzed, current file: apiserver/src/main/java/file195-----.java
[WARNING] Unresolved imports/types have been detected during analysis. Enable DEBUG mode to see them.
[INFO] Java "Main" source files AST scan (done) | time=1465001ms
[INFO] No "Test" source files to scan.
[INFO] No "Generated" source files to scan.
[INFO] Sensor JavaSensor [java] (done) | time=1469048ms
[INFO] Sensor CSS Rules [cssfamily]
......
My Jenkins step
stage("SonarQube Analysis") {
steps {
withSonarQubeEnv(installationName: 'sonar_token_access') {
container('maven') {
sh """
mvn sonar:sonar -Dsonar.scala.scoverage.disable=true -Dsonar.projectKey=projectKey -Dcalibrate-profile=${PROFILE} -Dsonar.login=$SONARQUBE_PROJECTS_TOKEN_ACCESS -Dsonar.projectName=${APPLICATION_NAME} -Dmaven.repo.local=$M2_REPOSITORY_DIR -s /usr/share/maven/ref/settings.xml
"""
}
}
}
}
Azure storage
Jenkins UI
Sonar plugin Jenkins