ocean icon indicating copy to clipboard operation
ocean copied to clipboard

[Integration][Bitbucket-cloud] Added folder kind mapping to integrations default

Open oiadebayo opened this issue 6 days ago • 2 comments

User description

Description

What - Added folder kind mapping as part of integration defaults to map folders 3 levels deep for every repositiry

Why -

How -

Type of change

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

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [ ] New Integration (non-breaking change which adds a new integration)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ ] Non-breaking change (fix of existing functionality that will not change current behavior)
  • [ ] Documentation (added/updated documentation)

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

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
  • [ ] Completed a full resync from a freshly installed integration and it completed successfully
  • [ ] 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.


PR Type

Enhancement


Description

  • Added folder kind mapping to Bitbucket Cloud integration defaults

  • Implemented global folder patterns support across all repositories

  • Enhanced folder processing to handle repo-specific and global patterns separately

  • Added comprehensive test coverage for new folder pattern functionality


Diagram Walkthrough

flowchart LR
  A["Folder Patterns"] --> B["Extract Repo Names & Global Patterns"]
  B --> C["Repo-Specific Patterns"]
  B --> D["Global Patterns"]
  C --> E["Process Specific Repos"]
  D --> F["Process All Repos"]
  E --> G["Yield Matching Folders"]
  F --> G

File Walkthrough

Relevant files
Enhancement
folder.py
Refactor folder pattern processing for global patterns     

integrations/bitbucket-cloud/bitbucket_cloud/helpers/folder.py

  • Refactored extract_repo_names_from_patterns() to return None when no
    repos specified, enabling global pattern processing
  • Added extract_global_patterns() function to extract patterns without
    repository constraints
  • Enhanced create_pattern_mapping() to return both repo-specific and
    global patterns as a tuple
  • Implemented process_repo_folders_global() function to apply global
    patterns across all repositories
  • Updated process_folder_patterns() to handle both repo-specific and
    global patterns with proper separation logic
  • Refactored process_repo_folders() to merge repo-specific and global
    patterns for each repository
  • Improved code structure with better separation of concerns between
    repo-specific and global pattern handling
+116/-32
Tests
test_folder.py
Expand test coverage for folder pattern functionality       

integrations/bitbucket-cloud/tests/helpers/test_folder.py

  • Updated test_extract_repo_names_from_patterns_no_repos() to expect
    None instead of empty set
  • Modified test_create_pattern_mapping() to verify both repo mapping and
    global patterns
  • Updated test_process_repo_folders() to use new function signature with
    global patterns parameter
  • Added test_find_matching_folders_three_level_wildcard() to validate
    3-level deep folder matching
  • Added test_process_repo_folders_global() to test global pattern
    processing on repositories
  • Added test_create_pattern_mapping_no_repos() to verify None return for
    repo mapping
  • Added test_extract_global_patterns() to test global pattern extraction
  • Added test_mixed_patterns() to validate handling of mixed
    repo-specific and global patterns
+108/-14
Bug fix
test_rate_limiter.py
Fix rate limiter test mocking strategy                                     

integrations/bitbucket-cloud/tests/helpers/test_rate_limiter.py

  • Changed mock strategy from patching wait_for_next_slot() method to
    patching asyncio.sleep()
  • Updated test to work around __slots__ limitation in rate limiter class
  • Maintains same test behavior while using more reliable mocking
    approach
+4/-4     
Configuration changes
port-app-config.yml
Add folder resource kind to integration config                     

integrations/bitbucket-cloud/.port/resources/port-app-config.yml

  • Added new folder resource kind to integration configuration
  • Configured folder selector with */*/* pattern to match 3-level deep
    folders
  • Added folder entity mappings with identifier, title, blueprint, and
    properties
  • Mapped folder properties including URL construction and default branch
    reference
+14/-0   
pyproject.toml
Update project version to 0.2.0                                                   

integrations/bitbucket-cloud/pyproject.toml

  • Bumped version from 0.1.100 to 0.2.0
+1/-1     
Documentation
CHANGELOG.md
Document version 0.2.0 release notes                                         

integrations/bitbucket-cloud/CHANGELOG.md

  • Added version 0.2.0 release entry with date 2025-11-24
  • Documented improvement: "Added folder kind mapping to bitbucket
    integration defaults"
+9/-1     

oiadebayo avatar Nov 24 '25 09:11 oiadebayo