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

[Integration][SonarQube] Bug | 404 response when querying SonarQube issues #1105

Merged
merged 8 commits into from
Oct 30, 2024

Conversation

lordsarcastic
Copy link
Contributor

@lordsarcastic lordsarcastic commented Oct 29, 2024

Description

What - Fixed a bug where SonarQube instances lower than 10.2 report a 404 error when retrieving issues

Why - This is because the issues list API on SonarQube was introduced in 10.2 and also as an internal API

How - Checking for the integration version and choosing the right API based on the integration version

Type of change

Please leave one option from the following and delete the rest:

  • Bug fix (non-breaking change which fixes an issue)

All tests should be run against the port production environment(using a testing org).

Core testing checklist

  • Integration able to create all default resources from scratch
  • Resync finishes successfully
  • Resync able to create entities
  • Resync able to update entities
  • Resync able to detect and delete entities
  • Scheduled resync able to abort existing resync and start a new one
  • Tested with at least 2 integrations from scratch
  • Tested with Kafka and Polling event listeners
  • Tested deletion of entities that don't pass the selector

Integration testing checklist

  • Integration able to create all default resources from scratch
  • Resync able to create entities
  • Resync able to update entities
  • Resync able to detect and delete entities
  • Resync finishes successfully
  • If new resource kind is added or updated in the integration, add example raw data, mapping and expected result to the examples folder in the integration directory.
  • If resource kind is updated, run the integration with the example data and check if the expected result is achieved
  • If new resource kind is added or updated, validate that live-events for that resource are working as expected
  • Docs PR link here

Preflight checklist

  • Handled rate limiting
  • Handled pagination
  • Implemented the code in async
  • Support Multi account

Screenshots

image

API Documentation

SonarQube issues list API

@lordsarcastic lordsarcastic requested a review from a team as a code owner October 29, 2024 07:19
Copy link
Contributor

@PeyGis PeyGis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great. left some comments

integrations/sonarqube/client.py Outdated Show resolved Hide resolved
integrations/sonarqube/client.py Outdated Show resolved Hide resolved
integrations/sonarqube/client.py Outdated Show resolved Hide resolved
Copy link
Contributor

@PeyGis PeyGis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left some comments and suggestions

Comment on lines 341 to 340
if self.is_onpremise:
query_params = {"project": component_key}
endpoint_path = Endpoints.ONPREM_ISSUES
else:
query_params = {"componentKeys": component_key}
endpoint_path = Endpoints.SAAS_ISSUES
query_params = {"componentKeys": component_key}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if self.is_onpremise:
query_params = {"project": component_key}
endpoint_path = Endpoints.ONPREM_ISSUES
else:
query_params = {"componentKeys": component_key}
endpoint_path = Endpoints.SAAS_ISSUES
query_params = {"componentKeys": component_key}
if self.is_onpremise:
query_params = {"components": component_key}
else:
query_params = {"componentKeys": component_key}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only components since we are using only one API

integrations/sonarqube/client.py Outdated Show resolved Hide resolved
integrations/sonarqube/client.py Outdated Show resolved Hide resolved
Copy link
Contributor

@PeyGis PeyGis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@PeyGis PeyGis merged commit 4a412d3 into main Oct 30, 2024
18 checks passed
@PeyGis PeyGis deleted the port-10941 branch October 30, 2024 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants