SonarQube webhook to notify GitLab

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    SonarQube = sonarqube-developer-8.4.1.35646
    Scanner = sonar-scanner-4.4.0.2170-windows
  • what are you trying to achieve
    I want to create a webhook to notify GitLab after every scan of C++ project
  • what have you tried so far to achieve this
    From GitLab
    I’ve created an Alert as follows

image.png

From SonarQube
I’ve created a Webhook as follows

image.png

Note that the URL is set with the Webhook URL from GitLab and the Secret is also set with the Authorization key from GitLab

Then I’ve executed a scan from SonarQube Runner to scan a C++ project and it has done successfully.

image.png

==> but I’ve seen no new Alert created from the GitLab Alerts page

Then I’ve executed this statement from Curl prompt to verify.
curl -X GET -u bbf841b95150f6c7d501c3d3bfb5b7c564ae6d16: http://localhost:9000/api/webhooks/list

And got this message
{“webhooks”:[{“key”:“AXSU_QB_momsnw2oNezp”,“name”:“GitLab”,“url”:"https://gitlab.com/brianvkn/sonarqubehook/alerts/notify.json",“latestDelivery”:{“id”:“AXSXRmA68Yocb3BQ-UHi”,“at”:“2020-09-16T07:16:45-0700”,"success":false,“httpStatus”:401,“durationMs”:463},“secret”:“ae6a5293dd68a0cc9c7bf3fbc6610aaf”}]}

==> httpStatus 401 is telling me that there was an issue with authentication. Could you help tell me what possibly was missing?

Thanks,

Brian

Hi Brian,

Unfortunately, none of your images came through. When I look at the source of your post I see references to mail.google.com so I don’t think what you intended is what happened.

 
Ann