-
Notifications
You must be signed in to change notification settings - Fork 122
Integration[Harbor]: initial integration #2283
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
base: main
Are you sure you want to change the base?
Integration[Harbor]: initial integration #2283
Conversation
This change does two things: - It wraps up the TDD approach to help us define our expected behaviors for pagination - ...and sets the setup the groundwork for our GoHarbor client
d7c4475
to
7173c6b
Compare
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new integration for GoHarbor container registry, enabling synchronization of Harbor resources into Port. The integration supports fetching projects, users, repositories, and artifacts through Harbor's v2.11.0 API.
- Implements a comprehensive Harbor API client with pagination, authentication, and error handling
- Provides resource synchronization for projects, users, repositories, and artifacts
- Includes complete test coverage for core functionality including pagination and client operations
Reviewed Changes
Copilot reviewed 25 out of 34 changed files in this pull request and generated 5 comments.
Show a summary per file
File | Description |
---|---|
integrations/goharbor_ocean/tests/test_pagination.py | Comprehensive test suite for pagination functionality across different Harbor resource types |
integrations/goharbor_ocean/tests/test_client.py | Unit tests for Harbor client initialization and API request handling |
integrations/goharbor_ocean/tests/fixtures.py | Test fixtures and mock objects for Harbor API responses |
integrations/goharbor_ocean/tests/conftest.py | Test configuration setup |
integrations/goharbor_ocean/harbor/client.py | Core Harbor API client implementation with async pagination and error handling |
integrations/goharbor_ocean/harbor/utils/constants.py | Harbor API constants and configuration values |
integrations/goharbor_ocean/harbor/utils/auth.py | Authentication utilities for Basic Auth |
integrations/goharbor_ocean/harbor/schemas.py | TypedDict schemas for Harbor API response structures |
integrations/goharbor_ocean/harbor/exceptions.py | Custom exception classes for Harbor integration errors |
integrations/goharbor_ocean/main.py | Integration entry point with resource synchronization logic |
integrations/goharbor_ocean/.port/spec.yaml | Integration specification and configuration schema |
integrations/goharbor_ocean/.port/resources/blueprints.json | Port blueprints for Harbor entities |
integrations/goharbor_ocean/.port/resources/port-app-config.yml | Entity mapping configuration |
integrations/goharbor_ocean/pyproject.toml | Python project configuration and dependencies |
Comments suppressed due to low confidence (2)
integrations/goharbor_ocean/tests/test_pagination.py:1
- The pagination logic assigns 'page' to 'page_size' instead of 'page'. This will cause incorrect API requests with the page number as the page size.
import pytest
integrations/goharbor_ocean/harbor/client.py:1
- Incorrect access to call_args.args - should be call_args[1] since call_args is already the args tuple.
"""
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
mock_http_response, | ||
mocked_artifact_response, | ||
): | ||
# should fetch artifats when both project_name and repository_name are provided |
Copilot
AI
Oct 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'artifats' to 'artifacts'.
# should fetch artifats when both project_name and repository_name are provided | |
# should fetch artifacts when both project_name and repository_name are provided |
Copilot uses AI. Check for mistakes.
async def test_handles_server_error( | ||
self, harbor_client_mocked, mock_async_client, mock_http_error | ||
): | ||
# should gracefuly handle server errors |
Copilot
AI
Oct 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'gracefuly' to 'gracefully'.
# should gracefuly handle server errors | |
# should gracefully handle server errors |
Copilot uses AI. Check for mistakes.
verify_ssl: bool = False, | ||
): | ||
""" | ||
Initalizes Harbor API client |
Copilot
AI
Oct 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'Initalizes' to 'Initializes'.
Initalizes Harbor API client | |
Initializes Harbor API client |
Copilot uses AI. Check for mistakes.
PR Code Suggestions ✨Explore these optional code suggestions:
|
ddc9dee
to
a4eda10
Compare
Co-authored-by: Copilot <[email protected]>
Description
What
Ocean's integration for GoHarbor. Allows data synchronization with Harbor's resources, currently, four major sources:
Why -
How
Performs data resync via connection polling, leveraging the framework's internals and the integration to work these resource kinds - effectively keeping information in-sync across both platforms.
Type of change
All tests should be run against the port production environment(using a testing org).
Core testing checklist
Integration testing checklist
examples
folder in the integration directory.Preflight checklist
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.