-
Notifications
You must be signed in to change notification settings - Fork 124
[Integration][Github] Added Support for Multi-Org #2274
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?
Conversation
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 |
PR Code Suggestions ✨Explore these optional code suggestions:
|
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.
LGTM
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.
Left small comments
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.
LGTM
User description
Description
What - Added comprehensive multi-organization support to the GitHub Ocean integration
Why - The current GitHub integration only supports a single organization, limiting its scalability and requiring separate integrations for each organization. This change enables users to manage multiple GitHub organizations through a single integration instance.
How -
OrganizationRequiredException
for better error handlinggithubOrganizations
fieldType of change
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.
PR Type
Enhancement, Tests
Description
• Added comprehensive multi-organization support to the GitHub Ocean integration, enabling management of multiple GitHub organizations through a single integration instance
• Updated all resync functions and resource exporters to iterate through multiple organizations using organization-specific clients
• Enhanced webhook processors to include organization context in payloads and processing logic
• Modified configuration schema to support
githubOrganizations
field while makinggithubOrganization
optional• Added new
OrganizationRequiredException
for better error handling and organization validation• Updated all core option types to inherit from organization-aware base classes
• Refactored utility functions to use
parse_github_options
instead ofextract_repo_params
for organization support• Enhanced file processing, folder mapping, and team management to work with organization-specific contexts
• Updated all test suites to include organization parameters and validate multi-organization functionality
• Added organization as a new resource kind in the integration specification
Diagram Walkthrough
File Walkthrough
41 files
main.py
Multi-organization support for GitHub integration
integrations/github/main.py
• Added comprehensive multi-organization support to all resync
functions
• Modified webhook subscription to iterate through multiple
organizations
• Updated all resource exporters to work with
organization-specific clients
• Added new
resync_organizations
function for organization management
core.py
Organization support in file exporter core
integrations/github/github/core/exporters/file_exporter/core.py
• Added
organization
parameter to all file-related methods• Updated
API endpoints to use organization-specific URLs
• Enhanced logging to
include organization context
• Modified file processing to handle
organization information
file_validation.py
Organization support in file validation service
integrations/github/github/webhook/webhook_processors/check_runs/file_validation.py
• Added organization parameter to
FileValidationService
constructor•
Updated check run creation and update methods to use
organization-specific endpoints
• Enhanced error logging to include
organization context
file_processor.py
Organization support in file processor
integrations/github/github/core/exporters/file_exporter/file_processor.py
• Added
organization
parameter to all file processing methods•
Updated
FileObject
creation to include organization information•
Modified file reference resolution to handle organization context
file_webhook_processor.py
Organization support in file webhook processor
integrations/github/github/webhook/webhook_processors/file_webhook_processor.py
• Added organization extraction from webhook payload
• Updated file
processing methods to include organization parameter
• Enhanced
logging to include organization context throughout
pull_request_exporter.py
Organization support in pull request exporter
integrations/github/github/core/exporters/pull_request_exporter.py
• Updated to use
parse_github_options
instead ofextract_repo_params
•
Modified API endpoints to use organization-specific URLs
• Enhanced
logging to include organization context
folder_exporter.py
Organization support in folder exporter
integrations/github/github/core/exporters/folder_exporter.py
• Updated
create_path_mapping
to handle organization-based repositorymapping
• Modified folder retrieval to work with organization-specific
repositories
• Added organization parameter to folder enrichment
methods
repository_exporter.py
Organization support in repository exporter
integrations/github/github/core/exporters/repository_exporter.py
• Added organization parameter to repository fetching methods
•
Updated API endpoints to use organization-specific URLs
• Modified
repository enrichment methods to include organization context
branch_exporter.py
Organization support in branch exporter
integrations/github/github/core/exporters/branch_exporter.py
• Added organization parameter to branch fetching methods
• Updated
API endpoints to use organization-specific URLs
• Modified branch
hydration and protection rule methods to include organization
team_member_and_repository_exporter.py
Organization support in team member repository exporter
integrations/github/github/core/exporters/team_exporter/team_member_and_repository_exporter.py
• Added organization parameter to team fetching methods
• Updated
GraphQL variables to use organization-specific queries
• Modified team
data retrieval to include organization context
utils.py
Enhance file exporter utilities with organization support
integrations/github/github/core/exporters/file_exporter/utils.py
• Added
organization
field toFileObject
TypedDict structure• Updated
file pattern grouping functions to handle organization-specific
repository fetching
• Enhanced logging to include organization context
throughout file processing
• Added
deep_dict
utility function forconverting defaultdict structures
folder_webhook_processor.py
Add organization support to folder webhook processor
integrations/github/github/webhook/webhook_processors/folder_webhook_processor.py
• Added organization extraction from webhook payload
• Updated folder
fetching logic to include organization parameter in repository options
• Enhanced logging messages to include organization context
• Modified
repository mapping structure to include organization hierarchy
team_with_members_exporter.py
Update team with members exporter for organization support
integrations/github/github/core/exporters/team_exporter/team_with_members_exporter.py
• Updated GraphQL team queries to use organization from options
instead of client
• Added organization parameter to all team member
fetching operations
• Modified paginated resources method to accept
ListTeamOptions
with organizationcheck_runs_validator_webhook_processor.py
Add organization support to check runs validator
integrations/github/github/webhook/webhook_processors/check_runs/check_runs_validator_webhook_processor.py
• Added organization extraction from webhook payload
• Updated file
validation service initialization with organization parameter
•
Modified commit diff fetching to include organization parameter
•
Enhanced logging to include organization context
utils.py
Enhance utility functions with organization support
integrations/github/github/helpers/utils.py
• Added
ORGANIZATION
enum value toObjectKind
• Renamed
extract_repo_params
toparse_github_options
with organization support• Updated
fetch_commit_diff
function to accept organization parameter• Enhanced repository search functions with organization context
user_exporter.py
Update user exporter for organization support
integrations/github/github/core/exporters/user_exporter.py
• Updated user fetching methods to use organization from options
instead of client
• Added organization parameter to external identity
fetching operations
• Modified paginated resources method to accept
ListUserOptions
collaborator_exporter.py
Update collaborator exporter for organization support
integrations/github/github/core/exporters/collaborator_exporter.py
• Updated to use
parse_github_options
instead ofextract_repo_params
•
Modified API endpoints to use organization from options
• Enhanced
logging to include organization context
• Added type casting for
repository name parameter
options.py
Add organization support to core options types
integrations/github/github/core/options.py
• Added new organization-related option types:
ListOrganizationOptions
,SingleOrganizationOptions
• Updated existing
option types to inherit from
SingleOrganizationOptions
• Modified
RepositoryIdentifier
to include organization parameter• Updated
folder options to support organization hierarchy in repository mapping
dependabot_exporter.py
Update dependabot exporter for organization support
integrations/github/github/core/exporters/dependabot_exporter.py
• Updated to use
parse_github_options
instead ofextract_repo_params
•
Modified API endpoints to use organization from options
• Enhanced
logging to include organization context
• Added type casting for
repository name parameter
secret_scanning_alert_exporter.py
Update secret scanning alert exporter for organization support
integrations/github/github/core/exporters/secret_scanning_alert_exporter.py
• Updated to use
parse_github_options
instead ofextract_repo_params
•
Modified API endpoints to use organization from options
• Enhanced
logging to include organization context
• Added type casting for
repository name parameter
release_exporter.py
Update release exporter for organization support
integrations/github/github/core/exporters/release_exporter.py
• Updated to use
parse_github_options
instead ofextract_repo_params
•
Modified API endpoints to use organization from options
• Enhanced
logging to include organization context
• Added type casting for
repository name parameter
team_exporter.py
Update team exporter for organization support
integrations/github/github/core/exporters/team_exporter/team_exporter.py
• Updated team fetching methods to use organization from options
instead of client
• Added organization parameter to team repository
fetching operations
• Modified paginated resources method to accept
ListTeamOptions
• Enhanced logging to include organization context
deployment_exporter.py
Update deployment exporter for organization support
integrations/github/github/core/exporters/deployment_exporter.py
• Updated to use
parse_github_options
instead ofextract_repo_params
•
Modified API endpoints to use organization from options
• Enhanced
logging to include organization context
• Added type casting for
repository name parameter
environment_exporter.py
Update environment exporter for organization support
integrations/github/github/core/exporters/environment_exporter.py
• Updated to use
parse_github_options
instead ofextract_repo_params
•
Modified API endpoints to use organization from options
• Enhanced
logging to include organization context
• Added type casting for
repository name parameter
tag_exporter.py
Update tag exporter for organization support
integrations/github/github/core/exporters/tag_exporter.py
• Updated to use
parse_github_options
instead ofextract_repo_params
•
Modified API endpoints to use organization from options
• Enhanced
logging to include organization context
• Added type casting for
repository name parameter
code_scanning_alert_exporter.py
Update code scanning alert exporter for organization support
integrations/github/github/core/exporters/code_scanning_alert_exporter.py
• Updated to use
parse_github_options
instead ofextract_repo_params
•
Modified API endpoints to use organization from options
• Enhanced
logging to include organization context
• Added type casting for
repository name parameter
membership_webhook_processor.py
Add organization support to membership webhook processor
integrations/github/github/webhook/webhook_processors/collaborator_webhook_processor/membership_webhook_processor.py
• Added organization extraction from webhook payload
• Updated team
repository fetching to include organization parameter
• Enhanced
logging messages to include organization context
• Modified
collaborator processing to use organization-specific operations
dependabot_webhook_processor.py
Add organization support to Dependabot webhook processor
integrations/github/github/webhook/webhook_processors/dependabot_webhook_processor.py
• Added organization extraction from webhook payload
• Updated logging
to include organization information
• Modified
SingleDependabotAlertOptions to include organization parameter
workflow_run_webhook_processor.py
Add organization support to workflow run webhook processor
integrations/github/github/webhook/webhook_processors/workflow_run_webhook_processor.py
• Added organization extraction from webhook payload
• Enhanced
logging messages to include organization context
• Updated
SingleWorkflowRunOptions to include organization parameter
team_webhook_processor.py
Add organization support to team webhook processor
integrations/github/github/webhook/webhook_processors/team_webhook_processor.py
• Added organization extraction from webhook payload
• Updated logging
messages to include organization information
• Modified
SingleTeamOptions to include organization parameter
release_webhook_processor.py
Add organization support to release webhook processor
integrations/github/github/webhook/webhook_processors/release_webhook_processor.py
• Added organization extraction from webhook payload
• Enhanced
logging to include organization context
• Updated SingleReleaseOptions
to include organization parameter
issue_webhook_processor.py
Add organization support to issue webhook processor
integrations/github/github/webhook/webhook_processors/issue_webhook_processor.py
• Added organization extraction from webhook payload
• Enhanced
logging messages with organization information
• Updated
SingleIssueOptions to include organization parameter
user_webhook_processor.py
Add organization support to user webhook processor
integrations/github/github/webhook/webhook_processors/user_webhook_processor.py
• Added organization extraction from webhook payload
• Updated logging
messages to include organization context
• Modified SingleUserOptions
to include organization parameter
branch_webhook_processor.py
Add organization support to branch webhook processor
integrations/github/github/webhook/webhook_processors/branch_webhook_processor.py
• Added organization extraction from webhook payload
• Enhanced
logging to include organization information
• Updated
SingleBranchOptions to include organization parameter
repository_webhook_processor.py
Add organization support to repository webhook processor
integrations/github/github/webhook/webhook_processors/repository_webhook_processor.py
• Added organization extraction from webhook payload
• Enhanced
logging messages with organization context
• Updated
SingleRepositoryOptions to include organization parameter
webhook_client.py
Add organization parameter to GitHub webhook client
integrations/github/github/webhook/webhook_client.py
• Added organization parameter to GithubWebhookClient constructor
•
Added organization instance variable to store organization context
integration.py
Add multi-organization configuration support to integration
integrations/github/integration.py
• Added organization field to FolderSelector and GithubFilePattern
models
• Added organizations field to GithubPortAppConfig for
multi-org support
• Updated configuration to make githubOrganization
optional
tag_webhook_processor.py
Add organization support to tag webhook processor
integrations/github/github/webhook/webhook_processors/tag_webhook_processor.py
• Added organization extraction from webhook payload
• Enhanced
logging messages with organization information
• Updated
SingleTagOptions to include organization parameter
deployment_webhook_processor.py
Add organization support to deployment webhook processor
integrations/github/github/webhook/webhook_processors/deployment_webhook_processor.py
• Added organization extraction from webhook payload
• Enhanced
logging to include organization context
• Updated
SingleDeploymentOptions to include organization parameter
base_repository_webhook_processor.py
Enhance base repository webhook processor validation chain
integrations/github/github/webhook/webhook_processors/base_repository_webhook_processor.py
• Updated validate_payload method to call parent class validation
first
• Improved validation chain to include organization validation
environment_webhook_processor.py
Add organization support to environment webhook processor
integrations/github/github/webhook/webhook_processors/environment_webhook_processor.py
• Added organization extraction from webhook payload
• Enhanced
logging messages with organization information
• Updated
SingleEnvironmentOptions to include organization parameter
27 files
test_team_exporter.py
Team exporter tests updated for multi-org
integrations/github/tests/github/core/exporters/test_team_exporter.py
• Updated test cases to include
organization
parameter inSingleTeamOptions
• Modified API endpoint assertions to use
organization-specific URLs
• Added organization context to all
team-related test scenarios
test_file_exporter.py
File exporter tests updated for multi-org
integrations/github/tests/github/core/exporters/test_file_exporter.py
• Added
organization
parameter toFileContentOptions
andFileSearchOptions
• Updated test assertions to verify
organization-specific API calls
• Modified file processing tests to
include organization context
test_file_entity_processor.py
File entity processor tests updated for multi-org
integrations/github/tests/github/entity_processors/test_file_entity_processor.py
• Added
owner
field withlogin
property to repository test data•
Updated test assertions to include organization parameter in API calls
• Modified all test scenarios to handle organization context
test_folder_exporter.py
Folder exporter tests updated for multi-org
integrations/github/tests/github/core/exporters/test_folder_exporter.py
• Updated folder pattern creation tests to include organization
parameter
• Modified repository mapping structure to support
organization-based grouping
• Updated test assertions for new
multi-organization folder structure
test_branch_exporter.py
Branch exporter tests updated for multi-org
integrations/github/tests/github/core/exporters/test_branch_exporter.py
• Added
organization
parameter toSingleBranchOptions
andListBranchOptions
• Updated API endpoint assertions to use
organization-specific URLs
• Modified branch fetching and enrichment
method signatures
test_utils.py
Utils tests updated for multi-org parsing
integrations/github/tests/github/helpers/test_utils.py
• Updated tests from
extract_repo_params
toparse_github_options
•
Added organization parameter handling in all test scenarios
• Modified
test assertions to verify organization extraction
test_dependabot_exporter.py
Dependabot exporter tests updated for multi-org
integrations/github/tests/github/core/exporters/test_dependabot_exporter.py
• Added
organization
parameter toSingleDependabotAlertOptions
andListDependabotAlertOptions
• Updated API endpoint assertions to use
organization-specific URLs
• Modified all test scenarios to include
organization context
test_code_scanning_alert_exporter.py
Update code scanning alert tests for multi-organization support
integrations/github/tests/github/core/exporters/test_code_scanning_alert_exporter.py
• Updated test methods to include
organization
parameter inSingleCodeScanningAlertOptions
andListCodeScanningAlertOptions
•
Modified API endpoint assertions to use organization from options
instead of client organization
• Added organization parameter to all
test cases for code scanning alert operations
test_file_validation.py
Update file validation tests for organization support
integrations/github/tests/github/webhook/webhook_processors/check_runs/test_file_validation.py
• Added organization parameter to
FileValidationService
initialization• Updated
FileObject
creation to include organization field• Modified
test assertions to include organization in API calls
• Updated file
pattern configurations with organization parameter
test_pull_request_exporter.py
Update pull request exporter tests for organization support
integrations/github/tests/github/core/exporters/test_pull_request_exporter.py
• Added organization parameter to
SinglePullRequestOptions
andListPullRequestOptions
in tests• Updated API endpoint assertions to
use organization from options
• Modified all test cases to include
organization context
test_user_exporter.py
Update user exporter tests for organization support
integrations/github/tests/github/core/exporters/test_user_exporter.py
• Added organization parameter to
SingleUserOptions
andListUserOptions
in tests• Updated GraphQL query assertions to use
organization from options
• Modified external identity fetching tests
to include organization parameter
test_folder_webhook_processor.py
Update folder webhook processor tests for organization support
integrations/github/tests/github/webhook/webhook_processors/test_folder_webhook_processor.py
• Added organization parameter to folder selector configurations
•
Updated webhook payload assertions to include organization
• Modified
repository mapping structure to include organization hierarchy
•
Updated API call assertions with organization parameter
test_secret_scanning_alert_exporter.py
Update secret scanning alert tests for organization support
integrations/github/tests/github/core/exporters/test_secret_scanning_alert_exporter.py
• Added organization parameter to alert options in all test methods
•
Updated API endpoint assertions to use organization from options
•
Modified test cases to include organization context throughout
test_repository_exporter.py
Update repository exporter tests for organization support
integrations/github/tests/github/core/exporters/test_repository_exporter.py
• Added organization parameter to repository options in tests
•
Updated API endpoint assertions to use organization from options
•
Modified collaborator request assertions to include organization
test_base_repository_webhook_processor.py
Update base repository webhook processor tests for organization
support
integrations/github/tests/github/webhook/webhook_processors/test_base_repository_webhook_processor.py
• Updated test payloads to include organization field
• Added
organization data to test cases for proper validation
test_file_webhook_processor.py
Update file webhook processor tests for organization support
integrations/github/tests/github/webhook/webhook_processors/test_file_webhook_processor.py
• Added organization field to GithubFilePattern test configurations
•
Updated test payload to include organization data
• Modified test
assertions to include organization parameter in method calls
test_pull_request_webhook_processor.py
Update pull request webhook processor tests for organization support
integrations/github/tests/github/webhook/webhook_processors/test_pull_request_webhook_processor.py
• Added organization field to test payloads
• Updated test assertions
to include organization parameter in SinglePullRequestOptions
test_issue_webhook_processor.py
Update issue webhook processor tests for organization support
integrations/github/tests/github/webhook/webhook_processors/test_issue_webhook_processor.py
• Added organization field to test payloads
• Updated test assertions
to include organization parameter in SingleIssueOptions
test_team_webhook_processor.py
Update team webhook processor tests for organization support
integrations/github/tests/github/webhook/webhook_processors/test_team_webhook_processor.py
• Added organization field to test payloads
• Updated test assertions
to include organization parameter in SingleTeamOptions
test_member_webhook_processor.py
Update member webhook processor tests for organization support
integrations/github/tests/github/webhook/webhook_processors/test_collaborator_webhook_processor/test_member_webhook_processor.py
• Added organization field to test payloads
• Updated test assertions
to include organization parameter in SingleCollaboratorOptions
test_tag_webhook_processor.py
Update tag webhook processor tests for organization support
integrations/github/tests/github/webhook/webhook_processors/test_tag_webhook_processor.py
• Added organization field to test payloads
• Updated test assertions
to include organization parameter in SingleTagOptions
test_release_webhook_processor.py
Update release webhook processor tests for organization support
integrations/github/tests/github/webhook/webhook_processors/test_release_webhook_processor.py
• Added organization field to test payloads
• Updated test assertions
to include organization parameter in SingleReleaseOptions
test_deployment_webhook_processor.py
Update deployment webhook processor tests for organization support
integrations/github/tests/github/webhook/webhook_processors/test_deployment_webhook_processor.py
• Added organization field to test payloads
• Updated test assertions
to include organization parameter in SingleDeploymentOptions
test_environment_webhook_processor.py
Update environment webhook processor tests for organization support
integrations/github/tests/github/webhook/webhook_processors/test_environment_webhook_processor.py
• Added organization field to test payloads
• Updated test assertions
to include organization parameter in SingleEnvironmentOptions
test_workflow_webhook_processor.py
Update workflow webhook processor tests for organization support
integrations/github/tests/github/webhook/webhook_processors/test_workflow_webhook_processor.py
• Added organization field to test payloads
• Updated test assertions
to include organization parameter in SingleWorkflowOptions
test_branch_webhook_processor.py
Update branch webhook processor tests for organization support
integrations/github/tests/github/webhook/webhook_processors/test_branch_webhook_processor.py
• Added organization field to test payloads
• Updated test assertions
to include organization parameter in SingleBranchOptions
test_team_webhook_processor.py
Update team collaborator webhook processor tests for organization
support
integrations/github/tests/github/webhook/webhook_processors/test_collaborator_webhook_processor/test_team_webhook_processor.py
• Updated test assertions to include organization parameter in team
exporter calls
1 files
spec.yaml
Update integration specification for multi-organization support
integrations/github/.port/spec.yaml
• Added organization as a new resource kind
• Made githubOrganization
configuration optional
• Updated description to reflect
multi-organization support
1 files
CHANGELOG.md
Add changelog entry for multi-organization support
integrations/github/CHANGELOG.md
• Added changelog entry for version 1.5.11-beta
• Documented
multi-organization support features
1 files
pyproject.toml
Bump version to 1.5.11-beta
integrations/github/pyproject.toml
• Updated version from 1.5.10-beta to 1.5.11-beta
33 files