diff --git a/integrations/gitlab/CHANGELOG.md b/integrations/gitlab/CHANGELOG.md index d9053f3f46..ec61ef0747 100644 --- a/integrations/gitlab/CHANGELOG.md +++ b/integrations/gitlab/CHANGELOG.md @@ -7,6 +7,14 @@ this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm +0.2.5 (2024-12-16) +================== + +### Improvements + +- Added labels as an extra property to the project kind response + + 0.2.4 (2024-12-15) ================== diff --git a/integrations/gitlab/gitlab_integration/gitlab_service.py b/integrations/gitlab/gitlab_integration/gitlab_service.py index 0ecaec3671..b2fa6519de 100644 --- a/integrations/gitlab/gitlab_integration/gitlab_service.py +++ b/integrations/gitlab/gitlab_integration/gitlab_service.py @@ -547,6 +547,18 @@ async def get_all_projects(self) -> typing.AsyncIterator[List[Project]]: else: logger.info("No valid projects found for the token in the current page") + @classmethod + async def async_project_labels_wrapper(cls, project: Project) -> dict[str, Any]: + try: + labels = await anyio.to_thread.run_sync(project.labels.list) + serialized_labels = [label.attributes for label in labels] + return {"__labels": serialized_labels} + except Exception as e: + logger.warning( + f"Failed to get labels for project={project.path_with_namespace}. error={e}" + ) + return {"__labels": []} + @classmethod async def async_project_language_wrapper(cls, project: Project) -> dict[str, Any]: try: @@ -562,6 +574,7 @@ async def async_project_language_wrapper(cls, project: Project) -> dict[str, Any async def enrich_project_with_extras(cls, project: Project) -> Project: tasks = [ cls.async_project_language_wrapper(project), + cls.async_project_labels_wrapper(project), ] tasks_extras = await asyncio.gather(*tasks) for task_extras in tasks_extras: diff --git a/integrations/gitlab/pyproject.toml b/integrations/gitlab/pyproject.toml index f7ea173be3..83dc642747 100644 --- a/integrations/gitlab/pyproject.toml +++ b/integrations/gitlab/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "gitlab" -version = "0.2.4" +version = "0.2.5" description = "Gitlab integration for Port using Port-Ocean Framework" authors = ["Yair Siman-Tov "]