Hello,
I experience a similar issue. Versions used
- Sonarqube 8.2.0.32929
- Sonar Jenkins Plugin: 2.11
The jenkins job is a multi branch pipeline.
The webhook is configured in sonarqube, and I see the payload with an HTTP 200 status.
Response: 200
Duration: 113ms
Payload
{
âserverUrlâ: âhttp://jenkinsâ,
âtaskIdâ: âAXFWtbW7SOnNud6I6PxCâ,
âstatusâ: âSUCCESSâ,
âanalysedAtâ: â2020-04-07T22:10:13+0000â,
ârevisionâ: â907e1221d7759c9e9831897f16e2560627569d4câ,
âchangedAtâ: â2020-04-07T22:10:13+0000â,
âprojectâ: {
âkeyâ: âmyproject:trunkâ,
ânameâ: âmyproject Trunkâ,
âurlâ: âhttp://jenkins/dashboard?id=myproject%3Atrunkâ
},
âbranchâ: {
ânameâ: âPR-3850â,
âtypeâ: âPULL_REQUESTâ,
âisMainâ: false,
âurlâ: âhttp://jenkins/dashboard?id=myproject%3Atrunk&pullRequest=PR-3850â
},
âqualityGateâ: {
ânameâ: âquality gateâ,
âstatusâ: âOKâ,
âconditionsâ: [
{
âmetricâ: ânew_blocker_violationsâ,
âoperatorâ: âGREATER_THANâ,
âvalueâ: â0â,
âstatusâ: âOKâ,
âerrorThresholdâ: â0â
},
{
âmetricâ: ânew_critical_violationsâ,
âoperatorâ: âGREATER_THANâ,
âvalueâ: â0â,
âstatusâ: âOKâ,
âerrorThresholdâ: â0â
},
{
âmetricâ: ânew_major_violationsâ,
âoperatorâ: âGREATER_THANâ,
âvalueâ: â0â,
âstatusâ: âOKâ,
âerrorThresholdâ: â0â
}
]
},
âpropertiesâ: {}
}
On Jenkins side, in the logs, I see the payload, that looks correct:
jenkins log
Apr 07, 2020 10:14:44 PM INFO org.sonarsource.scanner.jenkins.pipeline.SonarQubeWebHook doIndex
Received POST from xxx.xxx.xxx.xxx
Apr 07, 2020 10:14:44 PM FINE org.sonarsource.scanner.jenkins.pipeline.SonarQubeWebHook
Full details of the POST was {âserverUrlâ:âhttp://jenkinsâ,âtaskIdâ:âAXFWtbW7SOnNud6I6PxCâ,âstatusâ:âSUCCESSâ,âanalysedAtâ:â2020-04-07T22:10:13+0000â,ârevisionâ:â907e1221d7759c9e9831897f16e2560627569d4câ,âchangedAtâ:â2020-04-07T22:10:13+0000â,âprojectâ:{âkeyâ:âmyproject:trunkâ,ânameâ:âmyproject Trunkâ,âurlâ:âhttp://jenkins/dashboard?id=myproject%3Atrunk"},âbranchâ:{ânameâ:âPR-3850â,âtypeâ:âPULL_REQUESTâ,âisMainâ:false,âurlâ:âhttp://jenkins/dashboard?id=myproject%3Atrunk&pullRequest=PR-3850â},âqualityGateâ:{ânameâ:"Accounting quality gateâ,âstatusâ:âOKâ,âconditionsâ:[{âmetricâ:ânew_blocker_violationsâ,âoperatorâ:âGREATER_THANâ,âvalueâ:â0â,âstatusâ:âOKâ,âerrorThresholdâ:â0â},{âmetricâ:ânew_critical_violationsâ,âoperatorâ:âGREATER_THANâ,âvalueâ:â0â,âstatusâ:âOKâ,âerrorThresholdâ:â0â},{âmetricâ:ânew_major_violationsâ,âoperatorâ:âGREATER_THANâ,âvalueâ:â0â,âstatusâ:âOKâ,âerrorThresholdâ:â0â}]},âpropertiesâ:{}}
And the pipeline is blocked on the step âwaitForQualityGateâ until the timeout (10 minutes) (note that I verified the quality gate was ready before the end of the timeout) . Here is the log from the pipeline:
Wait for SonarQube analysis to be completed and return quality gate status10m 0s
Checking status of SonarQube task 'AXFVVnzRSOnNud6I6Pwj' on server 'SonarQube'
SonarQube task 'AXFVVnzRSOnNud6I6Pwj' status is 'IN_PROGRESS'
Please note that if the quality gate is ready after the start of the step âwaitForQualityGateâ, then the initial request to sonarqube will return status OK for QG, and the step will pass.
And I see some pipeline execution where the quality gate was in progress when entering the step âwaitForQualityGateâ and that then pass. ex:
Wait for SonarQube analysis to be completed and return quality gate status26s
Checking status of SonarQube task 'AXFVbj2QSOnNud6I6Pwr' on server 'SonarQube'
SonarQube task 'AXFVbj2QSOnNud6I6Pwr' status is 'IN_PROGRESS'
SonarQube task 'AXFVbj2QSOnNud6I6Pwr' status is 'SUCCESS'
SonarQube task 'AXFVbj2QSOnNud6I6Pwr' completed. Quality gate is 'OK'
So, I think my setup is correct, but it is more a race condition. I saw a post from Julien Henry talking about recently identified kind of race condition. In my case, task post-processing is in average between 10s and 1min.
Does anybody have an idea ?
Thank you.