Skip to content

Commit

Permalink
Fixed case where defaultBranch isn't available (#549)
Browse files Browse the repository at this point in the history
# Description

What - Fixed case where ADO integration would fail if default branch
isn't provided
Why - This is failing the integration from fetching repository policies
How - Add the key if exists in the repository data, ignore it if not

## Type of change

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

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

---------

Co-authored-by: Yair Siman Tov <63305203+yairsimantov20@users.noreply.github.com>
  • Loading branch information
matan84 and yairsimantov20 authored Apr 15, 2024
1 parent 1867ceb commit 126538a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
6 changes: 6 additions & 0 deletions integrations/azure-devops/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

<!-- towncrier release notes start -->

# Port_Ocean 0.1.11 (2024-04-15)

### Bug Fixes

- Made defaultBranch not required in the repository body when fetching repository policies

# Port_Ocean 0.1.10 (2024-04-11)

### Improvements
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,10 @@ async def generate_repository_policies(
for repo in repos:
params = {
"repositoryId": repo["id"],
"refName": repo["defaultBranch"],
}
if default_branch := repo.get("defaultBranch"):
params["refName"] = default_branch

policies_url = f"{self._organization_base_url}/{repo['project']['id']}/{API_URL_PREFIX}/git/policy/configurations"
repo_policies = (
await self.send_request("GET", policies_url, params=params)
Expand Down
2 changes: 1 addition & 1 deletion integrations/azure-devops/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "azure-devops"
version = "0.1.10"
version = "0.1.11"
description = "An Azure Devops Ocean integration"
authors = ["Matan Geva <matang@getport.io>"]

Expand Down

0 comments on commit 126538a

Please sign in to comment.