[Bug][Sonarqube] Can not load data scope
Search before asking
- [X] I had searched in the issues and found no similar issues.
What happened
Add Sonarqube connection successfully but its projects not loaded when adding Data scope.
What do you expect to happen
Should show Sonarqube projects.
How to reproduce
- Added & test connection succesfully
- Add data scope, it shows nothing in the popup window
Anything else
I found out that the key of the organization is required. Seems you are using deprecated API, check it out here.
Version
v0.21.0-beta6
Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
@ces-truongvu This seems to be a problem with filling in the connection, and the test connection does have a bug, which causes the user to test successfully even if he fills in the wrong information.
@ces-truongvu It will take effect in v0.21.0-beta7 version, expected to be released this week.
@abeizn Thank you.
Hi @abeizn,
I've updated to the latest version (v0.21.0.beta7), I believe this issue still not be fixed.
Steps to produce
Test connection works
But data scope does not show my projects.
What I found out
So, I've started development environment and modified the following file backend/plugins/sonarqube/api/remote_api.go by adding the required query string (organization) as it was written here, then it shows my projects.
I wish I can create the PR but I am not familiar with Golang. I hope that helpful. Thanks.
@ces-truongvu Are you using the sonarcloud version? We do not support sonarcloud yet, the corresponding issue is: https://github.com/apache/incubator-devlake/issues/4838.
The supported versions are shown in this document: https://devlake.apache.org/docs/Plugins/sonarqube
@ces-truongvu Are you using the sonarcloud version? We do not support sonarcloud yet, the corresponding issue is: #4838.
The supported versions are shown in this document: https://devlake.apache.org/docs/Plugins/sonarqube
@abeizn Yes, I'm using Sonar cloud. Got it, thanks for your support.
@ces-truongvu - We are using SonarQube Server - Enterprise EditionVersion 9.9.2 (build 77730). Connection is shown as successful. I still dont see projects. They are not loaded when adding Data scope. Can you please assist.
@ces-truongvu - We are using SonarQube Server - Enterprise EditionVersion 9.9.2 (build 77730). Connection is shown as successful. I still dont see projects. They are not loaded when adding Data scope. Can you please assist.
@mrpaapi Devlake only supports SonarQube v8.x, v9.x. Find out more here.
I'm not sure this issue is resolved?
I'm using 1.0.0-beta9 and still seeing the same behaviour.
When going to "Manage Connection" and click test, the UI says succeeded, but if you look at the logs, it actually failed.
When viewing the scopes, and you click test connection, this time it correct says disconnected / failed, and then not return anything.
The (redacted html) response from the search api on sonarqube is :
<body>
<div id="content">
<div class="global-loading">
<i class="spinner global-loading-spinner"></i>
<span aria-live="polite" class="global-loading-text">Loading...</span>
</div>
</div>
<script>
window.baseUrl = '';
window.serverStatus = 'UP';
window.instance = 'SonarQube';
window.official = true;
</script>
<script type="module" src="/js/outDBSRE6XU.js"></script>
</body>
The response should be json, not html which is why this fails.
Hmm, fault exists between chair and keyboard. Well, kindoff...
I realised that I entered the url wrong. I omitted the /api/ path in the url. Now I have it consistently returning with the correct json response from the API, but I still don't get any scopes back 🤔
Hmm, fault exists between chair and keyboard. Well, kindoff...
I realised that I entered the url wrong. I omitted the
/api/path in the url. Now I have it consistently returning with the correct json response from the API, but I still don't get any scopes back 🤔
@marais-vzc What's the sonarqube's version that you are using?
Latest LTS - SonarQube DC 9.9.5
SonarQube >9.2 and SonarCloud are not supported at this point. Collecting vote.
When can we expect to get DevLake support for SonarQube Enterprise Edition 10.5.1?
@sr2530 No one is working on it at this point, we are open for anyone who would like to contribute.
This issue has been automatically marked as stale because it has been inactive for 60 days. It will be closed in next 7 days if no further activity occurs.
not stale
@sr2530 No one is working on it at this point, we are open for anyone who would like to contribute.
Someone had submitted a PR, it just needs to be approved. https://github.com/apache/incubator-devlake/pull/7849
FYI. I am working on the Sonarcloud support now.
Hey everyone!
I'm experiencing a similar issue with the SonarCloud integration. I've successfully added the SonarCloud connection, but I'm encountering errors when trying to retrieve data from some specific repositories.
My setup:
- Using SonarCloud (not self-hosted SonarQube)
- Multiple repositories configured in SonarCloud
- DevLake version: v0.21.0-beta6 (same as reported in the issue)
Symptoms:
- The connection test passes successfully
- When collecting data, I get consistent 404 errors for specific repositories
Here's an excerpt of the error log I'm seeing:
subtask CollectAdditionalFilemetrics ended unexpectedly Wraps: (2) Error waiting for async Collector execution Wraps: (3) | combined messages: | { | Retry exceeded 3 times calling measures/component_tree. The last error was: Http DoAsync error calling [method:GET path:measures/component_tree query:map[ component:[myorg_web-api] metricKeys:[duplicated_lines_ density,duplicated_blocks,duplicated_lines, duplicated_files, complexity, cognitive_complexity, effort_to_reach_maintainability_rating_a, lines] p:[10] ps :[100] qualifiers:[FIL]]]. Response: {"errors":[{"msg":"Project doesn\u0027t exist"}]} (404)
The key issue appears to be that DevLake is trying to access a project with component ID myorg_web-api (I've anonymized the ID), but SonarCloud is responding with "Project doesn't exist" (404).
This project exists in my SonarCloud organization, and I can access it through the SonarCloud UI. However, DevLake consistently fails with the same error when trying to collect metrics for this repository. I've tried to call the measures/component_tree endpoint manually and I've noticed this is only happening in two repositories so far on my organization.
Has anyone else encountered similar problems with certain repositories in SonarCloud? Any suggestions for troubleshooting would be greatly appreciated.
Thanks for your help!
Hey everyone!
I'm experiencing a similar issue with the SonarCloud integration. I've successfully added the SonarCloud connection, but I'm encountering errors when trying to retrieve data from some specific repositories.
My setup:
- Using SonarCloud (not self-hosted SonarQube)
- Multiple repositories configured in SonarCloud
- DevLake version: v0.21.0-beta6 (same as reported in the issue)
Symptoms:
- The connection test passes successfully
- When collecting data, I get consistent 404 errors for specific repositories
Here's an excerpt of the error log I'm seeing:
subtask CollectAdditionalFilemetrics ended unexpectedly Wraps: (2) Error waiting for async Collector execution Wraps: (3) | combined messages: | { | Retry exceeded 3 times calling measures/component_tree. The last error was: Http DoAsync error calling [method:GET path:measures/component_tree query:map[ component:[myorg_web-api] metricKeys:[duplicated_lines_ density,duplicated_blocks,duplicated_lines, duplicated_files, complexity, cognitive_complexity, effort_to_reach_maintainability_rating_a, lines] p:[10] ps :[100] qualifiers:[FIL]]]. Response: {"errors":[{"msg":"Project doesn\u0027t exist"}]} (404)
The key issue appears to be that DevLake is trying to access a project with component ID
myorg_web-api(I've anonymized the ID), but SonarCloud is responding with "Project doesn't exist" (404).This project exists in my SonarCloud organization, and I can access it through the SonarCloud UI. However, DevLake consistently fails with the same error when trying to collect metrics for this repository. I've tried to call the
measures/component_treeendpoint manually and I've noticed this is only happening in two repositories so far on my organization.Has anyone else encountered similar problems with certain repositories in SonarCloud? Any suggestions for troubleshooting would be greatly appreciated.
Thanks for your help!
I've eventually found out that the problem was related to the lack of "Browser Project" permissions on the Sonar user rather than a problem with the DevLake integration.
Nothing to see here, then 😄
@rgcouto, great find! Would you like to add it to the document? If so, here is the website repo https://github.com/apache/incubator-devlake-website