I am using SonarQube 7.7 Developer Edition together with Bitbucket Server 5.9.0.
The PR analysis is working, but I tried to setup the PR decoration and I get this warning:
“Failed to create Bitbucket Server Quality Report for commit SHA ‘xxxxxxxxxxxxxxxxxxxxx’”.
And I can’t find anything else in the logs.
Here are the parts of the Scanner Context which I think are relevant:
I raised the log level to TRACE and I got this error:
2019.03.25 13:33:26 DEBUG ce[AWm0oFudNKbscBpl5JWA][c.s.C.C.A.A.C] Unable to contact Bitbucket server: 403 <!doctype html><html lang="en"><head><title>HTTP Status 403 – Forbidden</title><style type="text/css">h1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} h2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} h3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} body {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} b {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} p {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;} a {color:black;} a.name {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 403 – Forbidden</h1><hr class="line" /><p><b>Type</b> Status Report</p><p><b>Description</b> The server understood the request but refuses to authorize it.</p><hr class="line" /></body></html>
It’s not the same error I get when I call the API with an incorrect token:
{"errors":[{"context":null,"message":"You are not permitted to access this resource","exceptionName":"com.atlassian.bitbucket.AuthorisationException"}]}
I tried with and without the ‘/’ on the Bitbucket server URL, both gave the same 403 error. The pull request link on the SonarQube pull request page does have the correct link, so it seems like SonarQube has the correct information.
So close to get this working…
Let me know if there is anything else I can supply or help with.
In my Bitbucket server access log I see the following…
/rest/insights/1.0/projects/myProject/repos/My Repo/commits/70b82ba14a874d9c6d3a54fcac320307a4ed558a/ | … | 403
This looks like it is using the INSIGHTS API, which was not released in Bitbucket Server until 5.15. Since I am only using 5.9.1, the ‘feature’ of PR decoration will not work.