Hi Everyone,
What I’m trying to do:
Scan a Gradle multi module project via Jenkins pipeline. Here is my Jenkinsfile code for the scan:
Stage("Sonar") {
stagePrint(STAGE_NAME)
current_stage=STAGE_NAME
if (RUN_SONAR == false) {
return
}
sh """
rm /users/something/.gradle/caches/5.4.1/fileHashes/fileHashes.lock || true
rm /users/something/.gradle/caches/journal-1/journal-1.lock || true
./gradlew ${PROXY_GRADLE_OPTS} --no-daemon sonarqube
"""
withSonarQubeEnv() {
sh "./gradlew ${PROXY_GRADLE_OPTS} --no-daemon sonarqube"}
sleep(15)
timeout(time: 1, unit: 'HOURS') { /
def qg = waitForQualityGate()
if (qg.status != 'OK') {
error "Pipeline aborted due to quality gate failure: ${qg.status}"
}
}
} // End Sonar Stage
What happens is that the process scans all 4 modules but then the waitForQualityGate() only gets back result for one of the scans (see log)
WARN: Found multiple ‘report-task.txt’ in the workspace. Taking the first one.
/var/tmp/somecompeny/workspace/miniapp-android-sdk/app/build/sonar/report-task.txt
/var/tmp/somecompeny/workspace/miniapp-android-sdk/common/build/sonar/report-task.txt
/var/tmp/somecompeny/workspace/miniapp-android-sdk/host/build/sonar/report-task.txt
/var/tmp/somecompeny/workspace/miniapp-android-sdk/remote/build/sonar/report-task.txt
[Pipeline] // withSonarQubeEnv
[Pipeline] sleep
Sleeping for 15 sec
[Pipeline] timeout
Timeout set to expire in 1 hr 0 min
[Pipeline] {
[Pipeline] waitForQualityGate
Checking status of SonarQube task ‘AW5kx-_DIFBOU4d86ZSQ’ on server ‘ATTSonarQube’
SonarQube task ‘AW5kx-_DIFBOU4d86ZSQ’ status is ‘SUCCESS’
SonarQube task ‘AW5kx-_DIFBOU4d86ZSQ’ completed. Quality gate is ‘OK’
How can i direct the scanner so it will know it should pick up all 4 modules that got scanned?
Thanks in advance,
Versions that i’m using:
Sonarqube Version 6.7.6 (build 38781)
SonarQube Scanner for Jenkins v2.8.1