Skip to content

Commit

Permalink
[Core] Extend ocean new cli command (#1255)
Browse files Browse the repository at this point in the history
# Description

fixed the flow of the ocean new command since it was not working
properly by getting all data needed from the user and filling it out for
him, and added debug file



## Type of change

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

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] Documentation (added/updated documentation)

<h4> All tests should be run against the port production
environment(using a testing org). </h4>

### Core testing checklist

- [ ] Integration able to create all default resources from scratch
- [ ] Resync finishes successfully
- [ ] Resync able to create entities
- [ ] Resync able to update entities
- [ ] Resync able to detect and delete entities
- [ ] Scheduled resync able to abort existing resync and start a new one
- [ ] Tested with at least 2 integrations from scratch
- [ ] Tested with Kafka and Polling event listeners
- [ ] Tested deletion of entities that don't pass the selector


### Integration testing checklist

- [ ] Integration able to create all default resources from scratch
- [ ] Resync able to create entities
- [ ] Resync able to update entities
- [ ] Resync able to detect and delete entities
- [ ] Resync finishes successfully
- [ ] If new resource kind is added or updated in the integration, add
example raw data, mapping and expected result to the `examples` folder
in the integration directory.
- [ ] If resource kind is updated, run the integration with the example
data and check if the expected result is achieved
- [ ] If new resource kind is added or updated, validate that
live-events for that resource are working as expected
- [ ] Docs PR link [here](#)

### Preflight checklist

- [ ] Handled rate limiting
- [ ] Handled pagination
- [ ] Implemented the code in async
- [ ] Support Multi account

## Screenshots

Include screenshots from your environment showing how the resources of
the integration will look.

## API Documentation

Provide links to the API documentation used for this integration.

---------

Co-authored-by: Matan <[email protected]>
  • Loading branch information
yaelibarg and matan84 authored Dec 22, 2024
1 parent 5f6a891 commit 0cd4742
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 18 deletions.
11 changes: 11 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,17 @@
"python": "${workspaceFolder}/integrations/backstage/.venv/bin/python",
"request": "launch",
"type": "debugpy"
},
{
"console": "integratedTerminal",
"cwd": "${workspaceFolder}/port_ocean/cli",
"justMyCode": true,
"name": "Run ocean new command",
"program": "${workspaceFolder}/port_ocean/debug_cli.py",
"python": "${workspaceFolder}/.venv/bin/python",
"request": "launch",
"type": "debugpy",
"args": ["new"]
}
]
}
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

<!-- towncrier release notes start -->
## 0.15.3 (2024-12-22)

### Bug Fixes

- Extended `Ocean new` cli command to fill out more information for the user and also fixed wrong output


## 0.15.2 (2024-12-15)

Expand Down
23 changes: 15 additions & 8 deletions docs/framework-guides/docs/getting-started/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,25 @@ $ [email protected]
release_date [2023-08-06]:
$ 2023-08-06

is_private_integration [y/n] (y):
$ n

🌊 Ahoy, Captain! Your project is ready to set sail into the vast ocean of possibilities!
Here are your next steps:
port_client_id (you can find it using: https://docs.getport.io/build-your-software-catalog/custom-integration/api/#find-your-port-credentials):
$ <your-port-client-id>

port_client_secret (you can find it using: https://docs.getport.io/build-your-software-catalog/custom-integration/api/#find-your-port-credentials):
$ <your-port-client-secret>

⚓️ Install necessary packages: Run make install to install all required packages for your project.
▶️ cd ./my_integration && make install && . .venv/bin/activate
is_us_region [y/n] (n):
$ y

⚓️ Set sail with Ocean: Run ocean sail <path_to_integration> to run the project using Ocean.
▶️ ocean sail ./my_integration
🌊 Ahoy, Captain! Your project is ready to set sail into the vast ocean of possibilities!
Here are your next steps:

⚓️ Smooth sailing with Make: Alternatively, you can run make run to launch your project using Make.
▶️ make run ./my_integration
⚓️ Install necessary packages: Run cd ./my_integration && make install && . .venv/bin/activate to install all required packages for your project.
⚓️ Copy example env file: Run cp .env.example .env and update your integration's configuration in the .env file.
⚓️ Set sail with Ocean: Run ocean sail to run the project using Ocean.
⚓️ Smooth sailing with Make: Alternatively, you can run make run ./my_integration to launch your project using Make.
```
<br/>
Expand Down
11 changes: 4 additions & 7 deletions port_ocean/cli/commands/new.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,15 @@ def new(path: str, is_private_integration: bool) -> None:
)
console.print("Here are your next steps:\n", style="bold")
console.print(
"⚓️ Install necessary packages: Run [bold][blue]make install[/blue][/bold] to install all required packages for your project.\n"
f"▶️ [bold][blue]cd {path}/{name} && make install && . .venv/bin/activate[/blue][/bold]\n"
f"⚓️ Install necessary packages: Run [bold][blue]cd {path}/{name} && make install && . .venv/bin/activate[/blue][/bold] to install all required packages for your project."
)
console.print(
f"⚓️ Copy example env file: Run [bold][blue]cp {path}/{name}.env.example {path}/{name}/.env [/blue][/bold] and set your port credentials in the created file.\n"
"⚓️ Copy example env file: Run [bold][blue]cp .env.example .env [/blue][/bold] and update your integration's configuration in the .env file."
)
console.print(
"⚓️ Set sail with [blue]Ocean[/blue]: Run [bold][blue]ocean sail[/blue] <path_to_integration>[/bold] to run the project using Ocean.\n"
f"▶️ [bold][blue]ocean sail {path}/{name}[/blue][/bold] \n"
"⚓️ Set sail with [blue]Ocean[/blue]: Run [bold][blue]ocean sail[/blue][/bold] to run the project using Ocean."
)
if not final_private_integration:
console.print(
"⚓️ Smooth sailing with [blue]Make[/blue]: Alternatively, you can run [bold][blue]make run[/blue][/bold] to launch your project using Make. \n"
f"▶️ [bold][blue]make run {path}/{name}[/blue][/bold]"
f"⚓️ Smooth sailing with [blue]Make[/blue]: Alternatively, you can run [bold][blue]make run {path}/{name}[/blue][/bold] to launch your project using Make."
)
3 changes: 3 additions & 0 deletions port_ocean/cli/cookiecutter/cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
"email": "Your address email <[email protected]>",
"release_date": "{% now 'local' %}",
"is_private_integration": true,
"port_client_id": "you can find it using: https://docs.getport.io/build-your-software-catalog/custom-integration/api/#find-your-port-credentials",
"port_client_secret": "you can find it using: https://docs.getport.io/build-your-software-catalog/custom-integration/api/#find-your-port-credentials",
"is_us_region": false,
"_extensions": [
"jinja2_time.TimeExtension",
"extensions.VersionExtension"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
OCEAN__PORT__CLIENT_ID="<port-client-id>"
OCEAN__PORT__CLIENT_SECRET="<port-client-secret>"
OCEAN__PORT__CLIENT_ID={{ cookiecutter.port_client_id }}
OCEAN__PORT__CLIENT_SECRET={{ cookiecutter.port_client_secret }}
OCEAN__INTEGRATION__IDENTIFIER={{ cookiecutter.integration_slug }}
OCEAN__PORT__BASE_URL={% if cookiecutter.is_us_region %}https://api.us.getport.io{% else %}https://api.getport.io{% endif %}
OCEAN__EVENT_LISTENER__TYPE=POLLING
OCEAN__INITIALIZE_PORT_RESOURCES=true
5 changes: 5 additions & 0 deletions port_ocean/debug_cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from port_ocean.cli.commands.main import cli_start


if __name__ == "__main__":
cli_start()
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.15.2"
version = "0.15.3"
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 0cd4742

Please sign in to comment.