Webhook not working in Jenkins

57 views
Skip to first unread message

Javi D R

unread,
Jul 5, 2017, 7:23:38 AM7/5/17
to SonarQube
Hi

I am having some problems with Sonarqube qualitygate in Jenkins

I have a step like this to check the qualitygate

stage("Quality Gate") {
  timeout(time: 1, unit: 'HOURS') {
    def qg = waitForQualityGate()
    if (qg.status != 'OK') {
      error "Pipeline aborted due to quality gate failure: ${qg.status}"
    }
  }
 }



When executing, it remains in "IN_PROGRESS" status... until it gives a timeout

Timeout set to expire in 1 hr 0 min
[Pipeline] {
[Pipeline] waitForQualityGate
Checking status of SonarQube task 'AV0Sbi3ZpG-WqJEb8IOy' on server 'Sonarqube'
SonarQube task 'AV0Sbi3ZpG-WqJEb8IOy' status is 'IN_PROGRESS'

But checking the jenkins pipeline, it has been turned green, and also the task is marked as completed in the API ($sonarinstance/api/ce/task?id=AV0Sbi3ZpG-WqJEb8IOy)


{"task":{"organization":"default-organization","id":"AV0Sbi3ZpG-WqJEb8IOy","type":"REPORT","componentId":"AV0SZKpwpG-WqJEb8IOw","componentKey":"PoCPipeline","componentName":"PoCPipeline","componentQualifier":"TRK","analysisId":"AV0Sbi-T7cHLey_aoMNQ","status":"SUCCESS","submittedAt":"2017-07-05T11:06:36+0000","startedAt":"2017-07-05T11:06:37+0000","executedAt":"2017-07-05T11:06:42+0000","executionTimeMs":5356,"logs":false,"hasScannerContext":true}}


So, basically, looks like the jenkins job is not receiving this answer correctly


Any idea on what could be the problem?

Thanks

Julien HENRY

unread,
Jul 5, 2017, 8:28:33 AM7/5/17
to SonarQube
Hi,

You didn't forget to configure the webhook in your SonarQube server right?

When Jenkins receive the payload, it should log something.

++

Julien

Javi D R

unread,
Jul 7, 2017, 9:50:10 AM7/7/17
to SonarQube
Hi Julien

Nop, i have just seen what the problem is... not accepting self signed certificates

Its funny... the behaviour is like this

If the project doesnt exist in Sonar, the webhook works fine, but, if it already exists, as it is an analysis on an existing project, the webhook fails!

The error in the log says that certificate has been rejected, as it is self signed. Is there any option to configure this to accept insecure certificates?

Its also funny that if i put a sleep of 10 seconds in my jenkins pipeline before calling the quality gate, it also works...

Thanks
Reply all
Reply to author
Forward
0 new messages