Skip to content

Commit

Permalink
Merge branch 'main' into PORT-9873-add-jenkins-pipeline-stages-to-jen…
Browse files Browse the repository at this point in the history
…kins-integration
  • Loading branch information
phalbert committed Sep 20, 2024
2 parents 3061305 + 339d284 commit da8d93e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
8 changes: 8 additions & 0 deletions integrations/sonarqube/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

<!-- towncrier release notes start -->

## 0.1.95 (2024-09-19)


### Bug Fixes

- Added handling for 400 and 404 HTTP errors to allow the integration to continue processing other requests instead of crashing (0.1.95)


## 0.1.94 (2024-09-17)


Expand Down
16 changes: 14 additions & 2 deletions integrations/sonarqube/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,13 @@ async def send_paginated_api_request(

query_params = query_params or {}
query_params["ps"] = PAGE_SIZE
all_resources = [] # List to hold all fetched resources

try:
logger.debug(
f"Sending API request to {method} {endpoint} with query params: {query_params}"
)

all_resources = [] # List to hold all fetched resources

while True:
response = await self.http_client.request(
method=method,
Expand All @@ -135,6 +134,19 @@ async def send_paginated_api_request(
logger.error(
f"HTTP error with status code: {e.response.status_code} and response text: {e.response.text}"
)
if (
e.response.status_code == 400
and query_params.get("ps", 0) > PAGE_SIZE
and endpoint in [Endpoints.ONPREM_ISSUES, Endpoints.SAAS_ISSUES]
):
logger.error(
"The request exceeded the maximum number of issues that can be returned (10,000) from SonarQube API. Consider using apiFilters in the config mapping to narrow the scope of your search. Returning accumulated issues and skipping further results."
)
return all_resources

if e.response.status_code == 404:
logger.error(f"Resource not found: {e.response.text}")
return all_resources
raise
except httpx.HTTPError as e:
logger.error(f"HTTP occurred while fetching paginated data: {e}")
Expand Down
2 changes: 1 addition & 1 deletion integrations/sonarqube/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "sonarqube"
version = "0.1.94"
version = "0.1.95"
description = "SonarQube projects and code quality analysis integration"
authors = ["Port Team <support@getport.io>"]

Expand Down

0 comments on commit da8d93e

Please sign in to comment.