- Community Edition Version 8.6.1 (build 40680)
- Jenkins 2.356 with the 2.14 version of the Sonar Qube Scanner plugin
- Trying to scan 3 separate folders in a monorepo
- I have a sequential pipeline that scans one project, then waits for the Quality Gate before scanning the next project.
What I’m seeing is that all three scans produce different scan IDs but the waitForQualityGate step doesn’t always pick the most recent ID to wait for.
I see this was supposed to have been fixed in 2.8 as part of https://sonarsource.atlassian.net/browse/SONARJNKNS-299 but the fix doesn’t seem to be working in version 2.14 for me.
Here’s an anonymized version of our pipeline code:
stage("SonarQube-batch"){
when {
expression { env.BRANCH_NAME.startsWith("PR-") }
}
agent {
node {
label 'docker_node'
}
}
steps{
withSonarQubeEnv(credentialsId: '...',
installationName:'Sonar' ){
sh """
cd project-batch
mvn clean compile sonar:sonar
"""
}
}
}
stage("Quality Gate-batch") {
when {
expression { env.BRANCH_NAME.startsWith("PR-") }
}
steps {
timeout(time: 10, unit: 'MINUTES') {
waitForQualityGate(webhookSecretId: 'Sonar-Secret' , abortPipeline: true)
}
}
}
stage("SonarQube-services"){
when {
expression { env.BRANCH_NAME.startsWith("PR-") }
}
agent {
node {
label 'docker_node'
}
}
steps{
withSonarQubeEnv(credentialsId: '...',
installationName:'Sonar' ){
sh """
cd project-services
mvn clean compile sonar:sonar
"""
}
}
}
stage("Quality Gate-services") {
when {
expression { env.BRANCH_NAME.startsWith("PR-") }
}
steps {
timeout(time: 10, unit: 'MINUTES') {
waitForQualityGate(webhookSecretId: 'Sonar-Secret' , abortPipeline: true)
}
}
}
The maven logs for the scan have a line like this
https://sonarqube.example.com/api/ce/task?id=AYu2zeQ6279zphjWv_Cn
But the Wait step shows this:
Checking status of SonarQube task 'AYu2O_z5279zphjWv_CU' on server 'Sonar'