Skip to content

Commit

Permalink
[Gitlab] Fix still processing a file larger than the allowed size (#913)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tankilevitch authored Aug 19, 2024
1 parent 0f5b034 commit b3f8f25
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
9 changes: 9 additions & 0 deletions integrations/gitlab/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

<!-- towncrier release notes start -->

0.1.106 (2024-08-19)
====================

### Bug Fixes

- Fixed an issue when we were still processing a file larger than the allowed file size
- Added more verbosity to the logs of the file kind


0.1.105 (2024-08-15)
===================

Expand Down
17 changes: 13 additions & 4 deletions integrations/gitlab/gitlab_integration/gitlab_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,16 +604,25 @@ async def get_and_parse_single_file(
self, project: Project, file_path: str, branch: str
) -> dict[str, Any] | None:
try:
logger.info(
f"Processing file {file_path} in project {project.path_with_namespace}"
)
project_file = await AsyncFetcher.fetch_single(
project.files.get, file_path, branch
)
logger.info(
f"Fetched file {file_path} in project {project.path_with_namespace}"
)
project_file = typing.cast(ProjectFile, project_file)
parsed_file = self._parse_file_content(project_file)
project_file_dict = project_file.asdict()

if parsed_file:
# Update the content with the parsed content. Useful for JSON and YAML files that can be further processed using itemsToParse
project_file_dict["content"] = parsed_file
if not parsed_file:
# if the file is too large to be processed, we return None
return None

# Update the content with the parsed content. Useful for JSON and YAML files that can be further processed using itemsToParse
project_file_dict["content"] = parsed_file

return {"file": project_file_dict, "repo": project.asdict()}
except Exception as e:
Expand All @@ -628,7 +637,7 @@ async def get_all_files_in_project(
branch = project.default_branch
try:
file_paths = await self._get_file_paths(project, path, branch, True)
logger.debug(
logger.info(
f"Found {len(file_paths)} files in project {project.path_with_namespace} files: {file_paths}"
)
files = []
Expand Down
2 changes: 1 addition & 1 deletion integrations/gitlab/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "gitlab"
version = "0.1.105"
version = "0.1.106"
description = "Gitlab integration for Port using Port-Ocean Framework"
authors = ["Yair Siman-Tov <[email protected]>"]

Expand Down

0 comments on commit b3f8f25

Please sign in to comment.