Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SonarQube API reimport pullrequest #10098

Open
Nafanyya opened this issue May 2, 2024 · 10 comments
Open

SonarQube API reimport pullrequest #10098

Nafanyya opened this issue May 2, 2024 · 10 comments

Comments

@Nafanyya
Copy link

Nafanyya commented May 2, 2024

Hi!

When import result scan master branch from SonarQube with API. Import is correct.
Then reimport result scan PR with "branch tag" first time, reimport correct:
image
But if reimport second time this result scan PR with "branch tag", i have error: An exception error occurred during the report import:'NoneType' object is not iterable
image

Environment information

  • Operating System: [e.g. Ubuntu 22.04]
  • DefectDojo version 2.29.3
@Nafanyya Nafanyya added the bug label May 2, 2024
@kiblik
Copy link
Contributor

kiblik commented May 2, 2024

Can you please check and provide logs from uwsgi container? To see a whole context.

@Nafanyya
Copy link
Author

Nafanyya commented May 14, 2024

Can you please check and provide logs from uwsgi container? To see a whole context.

Logs:

[14/May/2024 08:29:06] ERROR [dojo.tools.api_sonarqube.importer:204] Unable to find the project projectname due to 404 - {"errors":[{"msg":"Component \u0027projectname\u0027 on branch \u002713752\u0027 not found"}]}
Traceback (most recent call last):
File "/app/dojo/tools/api_sonarqube/importer.py", line 109, in import_issues
component = client.get_project(
^^^^^^^^^^^^^^^^^^^
File "/app/dojo/tools/api_sonarqube/api_client.py", line 126, in get_project
raise Exception(
Exception: Unable to find the project projectname due to 404 - {"errors":[{"msg":"Component \u0027projectname\u0027 on branch \u002713752\u0027 not found"}]}
[14/May/2024 08:29:06] ERROR [dojo.tools.api_sonarqube.importer:327] Unable to find the project projectname due to 404 - {"errors":[{"msg":"Component \u0027projectname\u0027 on branch \u002713752\u0027 not found"}]}
Traceback (most recent call last):
File "/app/dojo/tools/api_sonarqube/importer.py", line 228, in import_hotspots
component = client.get_project(
^^^^^^^^^^^^^^^^^^^
File "/app/dojo/tools/api_sonarqube/api_client.py", line 126, in get_project
raise Exception(
Exception: Unable to find the project projectname due to 404 - {"errors":[{"msg":"Component \u0027projectname\u0027 on branch \u002713752\u0027 not found"}]}
[14/May/2024 08:29:06] ERROR [dojo.test.views:872] 'NoneType' object is not iterable
Traceback (most recent call last):
File "/app/dojo/test/views.py", line 863, in re_import_scan_results
reimporter.reimport_scan(scan, scan_type, test, active=active, verified=verified,
File "/app/dojo/importers/reimporter/reimporter.py", line 682, in reimport_scan
) = self.process_parsed_findings(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/dojo/decorators.py", line 48, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/celery/local.py", line 182, in call
return self._get_current_object()(*a, **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/celery/app/task.py", line 411, in call
return self.run(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/dojo/importers/reimporter/reimporter.py", line 71, in process_parsed_findings
for item in items:
TypeError: 'NoneType' object is not iterable

link from sonarqube: https://sonar.domain/dashboard?id=projectname&pullRequest=13752
in the branch tag field, I specified 13752, pullRequest=13752, &pullRequest=13752 and all the time i have a error 'NoneType' object is not iterable

@kiblik
Copy link
Contributor

kiblik commented May 14, 2024

DD-SQ integration supports branches only right now. You can use the name of the branch on which PR is open.

@kiblik
Copy link
Contributor

kiblik commented May 14, 2024

But it looks like a useful feature. Can you change the title and redefine it to a feature request? Somebody might have time and implement it for pullRequests as well.

@Nafanyya
Copy link
Author

DD-SQ integration supports branches only right now. You can use the name of the branch on which PR is open.

Name of branch like this?
image

@kiblik
Copy link
Contributor

kiblik commented May 14, 2024

Not 100% sure. I never used this functionality.

@Nafanyya Nafanyya changed the title SonarQube API reimport problem SonarQube API reimport pullrequest May 14, 2024
@Nafanyya
Copy link
Author

Not 100% sure. I never used this functionality.

I try reimport with name of branch and results was only error :(

@Nafanyya
Copy link
Author

But it looks like a useful feature. Can you change the title and redefine it to a feature request? Somebody might have time and implement it for pullRequests as well.

how can i changed to feature request?

@kiblik
Copy link
Contributor

kiblik commented May 14, 2024

@mtesauro, can we ask you to change this issue from 🐛 to feature request, please?

@Nafanyya
Copy link
Author

@mtesauro, can we ask you to change this issue from 🐛 to feature request, please?

I talked to my lead and he says that it's not a feature request it's a bug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants