Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help/Docs on how to test integration locally #368

Closed
markphelps opened this issue Jan 27, 2024 · 2 comments
Closed

Help/Docs on how to test integration locally #368

markphelps opened this issue Jan 27, 2024 · 2 comments

Comments

@markphelps
Copy link

Hi, I'm trying to develop a new integration with Ocean, but I have no idea how to get it to show up in Port to test it.

Do only merged integrations show up in the Port UI as a datasource?

How to I get my local ocean integration synching with Port during development?

config.yaml

initializePortResources: true
scheduledResyncInterval: 60
port:
  clientId: "{{ from env PORT_CLIENT_ID }}" # Can be loaded via environment variable: PORT_CLIENT_ID
  clientSecret: "{{ from env PORT_CLIENT_SECRET }}" # Can be loaded via environment variable: PORT_CLIENT_SECRET
# The event listener to use for the integration service.
eventListener:
  type: POLLING
integration:
  # The identifier of this integration instance.
  identifier: "flipt"
  # The type of the integration.
  type: "flipt"
  config:
    fliptToken: "{{ from env FLIPT_API_TOKEN }}"
    fliptURL: "{{ from env FLIPT_URL }}"

.port/spec.yaml

type: flipt
description: Flipt integration for Port Ocean
icon: Cookiecutter # Should be one of the available icons in Port
features:
  - type: exporter
    section: CICD # IDK if this is correct or what the valid sections
    resources:
      - kind: namespaces
      - kind: flags
configurations:
  - name: fliptToken
    required: true
    type: string
    sensitive: true
  - name: fliptURL
    type: url
    required: true

Logs

Setting sail... ⛵️⚓️⛵️⚓️ All hands on deck! ⚓️
🌊 Ocean version: 0.4.12
🚢 Integration version: 0.1.0
2024-01-27 14:30:18.717 | INFO     | Registering resync event listener for kind namespaces
2024-01-27 14:30:18.718 | INFO     | Creating integration with id: flipt
2024-01-27 14:30:18.718 | INFO     | No token found, fetching new token
2024-01-27 14:30:18.718 | INFO     | Fetching access token for clientId: REDACTED
2024-01-27 14:30:19.220 | ERROR    | Request failed with status code: 409, Error: {"ok":false,"error":"integration_installed","message":"The app for your organization already installed"}
2024-01-27 14:30:19.220 | ERROR    | Failed to create resources: {"ok":false,"error":"integration_installed","message":"The app for your organization already installed"}. Rolling back changes...
2024-01-27 14:30:19.220 | WARNING  | Failed to create resources. Rolling back blueprints : []
INFO:     Started server process [90575]
INFO:     Waiting for application startup.
2024-01-27 14:30:19.225 | INFO     | Starting integration
2024-01-27 14:30:19.225 | INFO     | Initializing integration components
2024-01-27 14:30:19.225 | INFO     | Initializing integration at port
2024-01-27 14:30:19.225 | INFO     | Initiating integration with id: flipt
2024-01-27 14:30:19.225 | INFO     | Fetching integration with id: flipt
2024-01-27 14:30:19.643 | INFO     | Checking for diff in integration configuration
Starting integration
2024-01-27 14:30:19.644 | INFO     | Integration with id: flipt successfully registered
2024-01-27 14:30:19.644 | INFO     | Event started
2024-01-27 14:30:19.645 | INFO     | Event finished
INFO:     Application startup complete.
2024-01-27 14:30:19.645 | INFO     | Initializing event listener
2024-01-27 14:30:19.645 | INFO     | Found event listener type: polling
2024-01-27 14:30:19.645 | INFO     | Setting up Polling event listener with interval: 60
2024-01-27 14:30:19.645 | INFO     | Setting up scheduled resync, the integration will automatically perform a full resync every 60 minutes)
2024-01-27 14:30:19.645 | INFO     | Polling event listener iteration after 60. Checking for changes
2024-01-27 14:30:19.646 | INFO     | Fetching integration with id: flipt
INFO:     Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
2024-01-27 14:30:19.746 | INFO     | Detected change in integration, resyncing
2024-01-27 14:30:19.747 | INFO     | Resync was triggered
2024-01-27 14:30:19.747 | INFO     | Event started
2024-01-27 14:30:19.747 | INFO     | Fetching port app config
2024-01-27 14:30:19.747 | INFO     | Fetching integration with id: flipt
2024-01-27 14:30:19.855 | INFO     | Searching entities with query {'combinator': 'and', 'rules': [{'property': '$datasource', 'operator': 'contains', 'value': 'port-ocean/flipt/'}, {'property': '$datasource', 'operator': 'contains', 'value': '/flipt/exporter'}]}
2024-01-27 14:30:19.974 | INFO     | Event finished
2024-01-27 14:31:19.977 | INFO     | Polling event listener iteration after 60. Checking for changes
2024-01-27 14:31:19.978 | INFO     | Fetching integration with id: flipt
2024-01-27 14:32:20.469 | INFO     | Polling event listener iteration after 60. Checking for changes
2024-01-27 14:32:20.470 | INFO     | Fetching integration with id: flipt
2024-01-27 14:33:20.870 | INFO     | Polling event listener iteration after 60. Checking for changes
2024-01-27 14:33:20.871 | INFO     | Fetching integration with id: flipt
2024-01-27 14:34:21.486 | INFO     | Polling event listener iteration after 60. Checking for changes
2024-01-27 14:34:21.487 | INFO     | Fetching integration with id: flipt
2024-01-27 14:35:21.846 | INFO     | Polling event listener iteration after 60. Checking for changes
2024-01-27 14:35:21.847 | INFO     | Fetching integration with id: flipt
2024-01-27 14:36:22.238 | INFO     | Polling event listener iteration after 60. Checking for changes
2024-01-27 14:36:22.239 | INFO     | Fetching integration with id: flipt
2024-01-27 14:36:22.650 | INFO     | Detected change in integration, resyncing
2024-01-27 14:36:22.651 | INFO     | Resync was triggered
2024-01-27 14:36:22.652 | INFO     | Event started
2024-01-27 14:36:22.653 | INFO     | Fetching port app config
2024-01-27 14:36:22.653 | INFO     | Fetching integration with id: flipt
2024-01-27 14:36:22.756 | INFO     | Searching entities with query {'combinator': 'and', 'rules': [{'property': '$datasource', 'operator': 'contains', 'value': 'port-ocean/flipt/'}, {'property': '$datasource', 'operator': 'contains', 'value': '/flipt/exporter'}]}
2024-01-27 14:36:22.875 | INFO     | Event finished
2024-01-27 14:37:22.876 | INFO     | Polling event listener iteration after 60. Checking for changes
2024-01-27 14:37:22.877 | INFO     | Fetching integration with id: flipt
2024-01-27 14:38:23.273 | INFO     | Polling event listener iteration after 60. Checking for changes
2024-01-27 14:38:23.274 | INFO     | Fetching integration with id: flipt
2024-01-27 14:39:23.707 | INFO     | Polling event listener iteration after 60. Checking for changes
2024-01-27 14:39:23.708 | INFO     | Fetching integration with id: flipt
2024-01-27 14:40:24.150 | INFO     | Polling event listener iteration after 60. Checking for changes
2024-01-27 14:40:24.150 | INFO     | Fetching integration with id: flipt
2024-01-27 14:41:24.549 | INFO     | Polling event listener iteration after 60. Checking for changes
2024-01-27 14:41:24.549 | INFO     | Fetching integration with id: flipt
2024-01-27 14:42:24.987 | INFO     | Polling event listener iteration after 60. Checking for changes
2024-01-27 14:42:24.988 | INFO     | Fetching integration with id: flipt
2024-01-27 14:43:25.402 | INFO     | Polling event listener iteration after 60. Checking for changes
2024-01-27 14:43:25.402 | INFO     | Fetching integration with id: flipt
^CINFO:     Shutting down
INFO:     Waiting for application shutdown.
INFO:     Application shutdown complete.
INFO:     Finished server process [90575]
@markphelps markphelps changed the title Docs on how to test integration locally Help/Docs on how to test integration locally Jan 27, 2024
@Tankilevitch
Copy link
Contributor

Hi @markphelps 👋

Happy to see you are developing an integration to Ocean 🤩 🌊

Do only merged integrations show up in the Port UI as a datasource?

Currently yes, we are planning to add a "development mode" support in the data sources where you will be able to test and develop new integrations.

For now you can manage the integration from the swagger interface in the /integrations api. You can generate the access token from the credentials section in the Port UI.

Screenshot 2024-01-28 at 10 21 41

How to I get my local ocean integration synching with Port during development?

You can trigger a resync by sending a patch request to the integration endpoint, when using the default event listener "POLLING" in ocean, it queries each 60 seconds whether any change was made to the integration and if so, triggers a resync.

Note that the resources / integration config you configured the .port/resources won't get updated / re-created if in the setup of the integration it detects that an integration with the same integration id already exists or if one of the resources it should create already exists.

@yairsimantov20
Copy link
Collaborator

Closing this issue for #370

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants