SonarQube plugin for Bitbucket does not immediately show the SonarQube issues inline with the code a

Anubhav Kumar September 8, 2020

SonarQube plugin for Bitbucket does not immediately show the SonarQube issues inline with the code after the scan for the pull request is completed and you have to manually force the plugin to get the issues displayed by selecting the "Refresh Sonar analysis" option in bitbucket.refresh_sonar_analysis (1).pngBB Vendor Plgin Issue.PNGrefresh_sonar_analysis (1).png

1 answer

0 votes
Michael Rüegg _Mibex Software_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 8, 2020

Hi,

The app will automatically add issue information to your pull requests when it gets informed by SonarQube about new analysis results through webhooks.

If that doesn't happen, and you need to manually refresh it, then something with the webhook configuration is wrong.

Could you please check if you see a working webhook under SonarQube admin -> general -> webhooks?

Thanks,
Michael (app vendor)

Anubhav Kumar September 8, 2020

Hey Michael Thanks for response. Can you tell me where do I need to check this thing   working webhook under SonarQube admin -> general -> webhooks?

In Sonarqube or in bitbucket do I need to check?

Anubhav Kumar September 8, 2020

Hi Michael Can you reply for above query.

Michael Rüegg _Mibex Software_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 8, 2020

You're very welcome. In SonarQube.

Anubhav Kumar September 8, 2020

Yes that i understood In Sonarqube i need to check but in "Administration" I need to go and then general and then webhooks or else you want to convey.

Anubhav Kumar September 8, 2020

Hi Michael Yes I found the web hook configuration in sonarqube but wondering how to check whether it's working properly or not. Can you suggest this thing.

Thanks

Michael Rüegg _Mibex Software_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 8, 2020

Do you see an entry in the web hook list with an URL targeting your Bitbucket Server instance?

Is there a green tick under the column "Last delivery"?

Anubhav Kumar September 8, 2020

BB Plugin Issue.PNGYes i see the Url but it's not green tick that means something wrong with webhook configuration. How can I correct this thing?

Michael Rüegg _Mibex Software_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 9, 2020

What error do you get? You see the error details by clicking on the right icon?

Anubhav Kumar September 9, 2020

Getting this message

Response: Server Unreachable

Duration: 7ms

Payload:

{
"serverUrl": "http://sonarqube.sunlifecorp.com:9000",
"taskId": "AXRxuLlEE_lwDT5vH3oN",
"status": "SUCCESS",
"analysedAt": "2020-09-09T07:14:49+0000",
"revision": "976613025056c8e4c4105daf14ca2579c31fdbd4",
"changedAt": "2020-09-09T07:14:49+0000",
"project": {
"key": "ca.sunlife.ind.web:ind-web-policy-lumarketindex",
"name": "ca.sunlife.ind.web.ind-web-policy-lumarketindex",
"url": "http://sonarqube.sunlifecorp.com:9000/dashboard?id=ca.sunlife.ind.web%3Aind-web-policy-lumarketindex"
},
"branch": {
"name": "develop",
"type": "BRANCH",
"isMain": true,
"url": "http://sonarqube.sunlifecorp.com:9000/dashboard?id=ca.sunlife.ind.web%3Aind-web-policy-lumarketindex"
},
"qualityGate": {
"name": "SLF Quality Gate - 90%",
"status": "ERROR",
"conditions": [
{
"metric": "new_security_rating",
"operator": "GREATER_THAN",
"value": "1",
"status": "OK",
"errorThreshold": "1"
},
{
"metric": "new_coverage",
"operator": "LESS_THAN",
"value": "88.53159433325838",
"status": "ERROR",
"errorThreshold": "90"
},
{
"metric": "new_blocker_violations",
"operator": "GREATER_THAN",
"value": "0",
"status": "OK",
"errorThreshold": "0"
},
{
"metric": "new_vulnerabilities",
"operator": "GREATER_THAN",
"value": "0",
"status": "OK",
"errorThreshold": "0"
}
]
},
"properties": {}
}

Michael Rüegg _Mibex Software_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 9, 2020

Regarding " Server Unreachable": Is it possible that due to network/firewall settings, SonarQube cannot access Bitbucket Server?

Anubhav Kumar September 9, 2020

Hey Michael Thanks for replying.

But I am not sure about this thing that when server is Unreachable what need to do. That's why I raised a question here just to get the solution of the behavior  of this particular "Sonar for bit bucket" plugin. Why it's not working. 

As from atlassian community they already told this thing that this plugin is a third-party supported for which vendor Is "Mibex". So they told that you need to check with the vendor of Mibex team for this issue.

And I think If I am not mistaken then Michael you are from "Mibex Team" who is looking into this issue.

So, Please suggest the ways to tackle the problem. I have already send you the error message completely and screenshots as well so that you will better understand them.

Michael Rüegg _Mibex Software_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 9, 2020

You're very welcome. The web hook configuration looks OK. But SonarQube could not reach Bitbucket Server when executing the web hook. That could have various (internal network) reasons. I would suggest that you try to ping Bitbucket from SonarQube to see if your network configuration allows it. Please let me know if this helps.

Anubhav Kumar September 9, 2020

Okay But Michael how can i ping from Sonarqube Server.

As the reports generation and code analysis process is going on from bitbucket to sonarqube. Our Users are doing this thing with no issues. I think if this task is work then possibly the server is reachable from sonarqube to bitbucket.

Or is there any other way if you suggest so that I can check this point?

Anubhav Kumar September 9, 2020

And one more thing I wanted to confirm from you that I was reading "Sonar for bit bucket server plugin" document and found that editions mentioned are only 2(community and commercial edition) What it means Is this plugin will not be applicable/working in Bit bucket if we have "Enterprise Edition Of Sonarqube running".(See attachment for this).

So, FYI currently we are using Sonarqube version 8.2 of Enterprise Edition.

I am reading this document from below link:-

https://mibexsoftware.atlassian.net/wiki/spaces/MSS/pages/162398304/How+to+setup+Sonar+for+Bitbucket

Sonar for BB Plugin Issue Docs.PNG

Michael Rüegg _Mibex Software_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 9, 2020

I would get into contact with your network team to see if a connection between SonarQube -> Bitbucket is possible.

Commercial editions means both "Developer" and "Enterprise" edition. So that will work.

Hope that helps. Otherwise, please let me know.

Anubhav Kumar September 9, 2020

Okay Thanks Michael for confirmation.

Please keep me updated regarding the network team connect.

Anubhav Kumar September 9, 2020

Also Michael I thing i found something missing in my bitbucket server in repository settings(See attachments).

Sonar Plugin New branch feature missing.PNGBut when I am reading this document from below link:-

https://mibexsoftware.atlassian.net/wiki/spaces/SONAR4STASH/pages/197165057/Migrating+to+the+new+Sonar+6.7+LTS+branch+plug-in

Then here, a different option is coming in step no.-8Mibex Plugin Sonar Doc.PNG of above link which is "use new branching feature" option is coming in above link but in my bitbucket server in repo settings this option is not coming.(see attachments).

 

May be this is something we need to check.

Michael Rüegg _Mibex Software_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 9, 2020

Would it be possible for you to create a support ticket at https://support.mibexsoftware.com ? That will help us to better support you so that we can exchange log files etc.

Please reference this community article when you submit a support request. Thanks!

Anubhav Kumar September 9, 2020

Hey Michael I have created the support request over the above link.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events