Skip to content

Commit

Permalink
[Integrations][Gitlab] Listen to default branch of repository by defa…
Browse files Browse the repository at this point in the history
…ult (#461)
  • Loading branch information
talru1123 authored Mar 26, 2024
1 parent 1e1c871 commit df655e7
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
8 changes: 8 additions & 0 deletions integrations/gitlab/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

<!-- towncrier release notes start -->

0.1.60 (2024-03-25)
===================

### Features

- Changed listening to default branch unless mentioned otherwise in mapping (PORT-7141)


0.1.59 (2024-03-24)
===================

Expand Down
6 changes: 4 additions & 2 deletions integrations/gitlab/gitlab_integration/events/hooks/push.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@ async def _on_hook(self, body: dict[str, Any], gitlab_project: Project) -> None:
GitlabPortAppConfig, event.port_app_config
)

if generate_ref(config.branch) == ref:
branch = config.branch or gitlab_project.default_branch

if generate_ref(branch) == ref:
entities_before, entities_after = self.gitlab_service.get_entities_diff(
gitlab_project,
config.spec_path,
before,
after,
config.branch,
branch,
)
# update the entities diff found in the `config.spec_path` file the user configured
await ocean.update_diff(
Expand Down
2 changes: 1 addition & 1 deletion integrations/gitlab/gitlab_integration/git_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class GitlabResourceConfig(ResourceConfig):

class GitlabPortAppConfig(PortAppConfig):
spec_path: str | List[str] = Field(alias="specPath", default="**/port.yml")
branch: str = "main"
branch: str | None
filter_owned_projects: bool | None = Field(
alias="filterOwnedProjects", default=True
)
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.59"
version = "0.1.60"
description = "Gitlab integration for Port using Port-Ocean Framework"
authors = ["Yair Siman-Tov <[email protected]>"]

Expand Down

0 comments on commit df655e7

Please sign in to comment.