Skip to content

Commit

Permalink
[Core][Port-9473] Migrate to actions v2 (#896)
Browse files Browse the repository at this point in the history
# Description

What - Change Defaults Action CREATE route to new actions
Why - Deprecation of v1
How - Change route and expected format of actions.json file

## Type of change

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

- [ ] New feature (non-breaking change which adds functionality)
  • Loading branch information
matan84 authored Aug 13, 2024
1 parent c975947 commit bdc4b63
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 12 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

<!-- towncrier release notes start -->

## 0.9.13 (2024-08-13)

### Improvements

- Changed action CREATE route to use new v2 option


## 0.9.12 (2024-08-06)

### Bug Fixes
Expand Down
6 changes: 2 additions & 4 deletions port_ocean/clients/port/mixins/blueprints.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,10 @@ async def delete_blueprint(
handle_status_code(response, should_raise)
return response.json().get("migrationId", "")

async def create_action(
self, blueprint_identifier: str, action: dict[str, Any]
) -> None:
async def create_action(self, action: dict[str, Any]) -> None:
logger.info(f"Creating action: {action}")
response = await self.client.post(
f"{self.auth.api_url}/blueprints/{blueprint_identifier}/actions",
f"{self.auth.api_url}/actions",
json=action,
headers=await self.auth.headers(),
)
Expand Down
2 changes: 1 addition & 1 deletion port_ocean/core/defaults/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Preset(TypedDict):

class Defaults(BaseModel):
blueprints: list[dict[str, Any]] = []
actions: list[Preset] = []
actions: list[dict[str, Any]] = []
scorecards: list[Preset] = []
pages: list[dict[str, Any]] = []
port_app_config: Optional[PortAppConfig] = Field(
Expand Down
8 changes: 2 additions & 6 deletions port_ocean/core/defaults/initialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@


def deconstruct_blueprints_to_creation_steps(
raw_blueprints: list[dict[str, Any]]
raw_blueprints: list[dict[str, Any]],
) -> tuple[list[dict[str, Any]], ...]:
"""
Deconstructing the blueprint into stages so the api wont fail to create a blueprint if there is a conflict
Expand Down Expand Up @@ -154,11 +154,7 @@ async def _create_resources(
)

await asyncio.gather(
*(
port_client.create_action(blueprint_actions["blueprint"], action)
for blueprint_actions in defaults.actions
for action in blueprint_actions["data"]
)
*(port_client.create_action(action) for action in defaults.actions)
)

await asyncio.gather(
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "port-ocean"
version = "0.9.12"
version = "0.9.13"
description = "Port Ocean is a CLI tool for managing your Port projects."
readme = "README.md"
homepage = "https://app.getport.io"
Expand Down

0 comments on commit bdc4b63

Please sign in to comment.