-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat: bitbucket connector #5294
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
feat: bitbucket connector #5294
Conversation
@danielkravets is attempting to deploy a commit to the Danswer Team on Vercel. A member of the Team first needs to authorize it. |
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.
Greptile Summary
This PR introduces a comprehensive Bitbucket Cloud connector that enables users to index and search pull requests from their Bitbucket repositories. The implementation follows established patterns from existing connectors like GitHub, GitLab, and Confluence, providing a consistent user experience.
Backend Implementation:
- Connector Architecture: The
BitbucketConnector
class implements the standard connector interfaces (LoadConnector
,PollConnector
,SlimConnector
) with comprehensive API integration, retry logic, and rate limiting - Flexible Targeting: Supports three indexing modes - specific repositories, all repositories within projects, or entire workspace scanning
- Pruning Logic: Includes configurable retention of closed pull requests with time-based cleanup (default disabled with -1 days)
- API Integration: Utilizes Bitbucket Cloud API with proper authentication via email/API token, comprehensive field selection, and pagination handling
- Document Mapping: Transforms Bitbucket PR data into Onyx's Document format with rich metadata preservation including author information, timestamps, and PR details
Frontend Integration:
- UI Configuration: Tab-based configuration interface allowing users to choose between repository, project, or workspace-level indexing
- Credential Management: Integrates with existing credential system requiring email and API token for authentication
- Visual Elements: Includes proper Bitbucket branding with official colors and logo in the BitbucketIcon component
- Type Safety: Full TypeScript support with proper interface definitions (
BitbucketCredentialJson
,BitbucketConfig
)
System Integration:
- Source Registration: Properly registers
BITBUCKET
as a new DocumentSource throughout the system (constants, factory, types) - Testing Framework: Includes comprehensive test suite covering basic functionality, polling, and slim document operations
- Documentation Ready: Structured to integrate with existing documentation patterns
The connector architecture supports both full indexing and incremental updates, making it suitable for organizations of various sizes. The implementation demonstrates solid understanding of Onyx's connector framework and maintains consistency with existing patterns while accommodating Bitbucket-specific requirements.
Confidence score: 4/5
- This PR introduces a well-structured connector with comprehensive functionality, but contains some implementation concerns that should be addressed
- Score reflects solid overall architecture following established patterns, but points are deducted for test logic issues and potential edge case handling
- Pay close attention to the test files and connector validation logic which contain critical issues that could cause failures
14 files reviewed, 4 comments
|
||
def test_bitbucket_poll_source(bitbucket_connector: BitbucketConnector) -> None: | ||
current = time.time() | ||
specific_date = 1755004439 # Tue Aug 12 2025 13:13:59.797 UTC |
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.
logic: Future timestamp will cause test failure. Use a past date or dynamic calculation based on current time
specific_date = 1755004439 # Tue Aug 12 2025 13:13:59.797 UTC | |
specific_date = int(current - 86400 * 30) # 30 days ago |
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.
For this test, I used my own workspace, and I don't want the test to expire (pull nothing).
The specific date is exactly for the test to do a meaningful job.
But just let me know if this is important.
backend/tests/daily/connectors/bitbucket/test_bitbucket_slim_connector.py
Outdated
Show resolved
Hide resolved
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.
4 issues found across 14 files
React with 👍 or 👎 to teach cubic. You can also tag @cubic-dev-ai
to give feedback, ask questions, or re-run the review.
backend/tests/daily/connectors/bitbucket/test_bitbucket_basic.py
Outdated
Show resolved
Hide resolved
072ac37
to
ff511e2
Compare
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.
13 issues found across 14 files
React with 👍 or 👎 to teach cubic. You can also tag @cubic-dev-ai
to give feedback, ask questions, or re-run the review.
], | ||
advanced_values: [ | ||
{ | ||
type: "number", |
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.
Numeric field will be validated as a string because the schema lacks a number case; add Yup.number() handling in createConnectorValidationSchema to enforce numeric input and avoid coercion issues.
Prompt for AI agents
Address the following comment on web/src/lib/connectors/connectors.tsx at line 349:
<comment>Numeric field will be validated as a string because the schema lacks a number case; add Yup.number() handling in createConnectorValidationSchema to enforce numeric input and avoid coercion issues.</comment>
<file context>
@@ -282,6 +282,80 @@ export const connectorConfigs: Record<
+ ],
+ advanced_values: [
+ {
+ type: "number",
+ description:
+ "Prune closed PRs after N days (use -1 to disable pruning, 0 to prune immediately)",
</file context>
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.
not sure if this is relevant, looks that other connectors are dealing with numbers in the same way
backend/tests/daily/connectors/bitbucket/test_bitbucket_slim_connector.py
Show resolved
Hide resolved
backend/tests/daily/connectors/bitbucket/test_bitbucket_slim_connector.py
Outdated
Show resolved
Hide resolved
backend/tests/daily/connectors/bitbucket/test_bitbucket_slim_connector.py
Outdated
Show resolved
Hide resolved
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.
2 issues found across 14 files
React with 👍 or 👎 to teach cubic. You can also tag @cubic-dev-ai
to give feedback, ask questions, or re-run the review.
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.
5 issues found across 14 files
React with 👍 or 👎 to teach cubic. You can also tag @cubic-dev-ai
to give feedback, ask questions, or re-run the review.
backend/tests/daily/connectors/bitbucket/test_bitbucket_basic.py
Outdated
Show resolved
Hide resolved
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.
5 issues found across 14 files
React with 👍 or 👎 to teach cubic. You can also tag @cubic-dev-ai
to give feedback, ask questions, or re-run the review.
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.
7 issues found across 14 files
React with 👍 or 👎 to teach cubic. You can also tag @cubic-dev-ai
to give feedback, ask questions, or re-run the review.
backend/tests/daily/connectors/bitbucket/test_bitbucket_basic.py
Outdated
Show resolved
Hide resolved
059e0a5
to
cc0987e
Compare
bc20c5f
to
0e77d19
Compare
0e77d19
to
9375ecf
Compare
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.
Looks good! Pretty much ready for merging, I just have a few nits. looking forward to getting this in ASAP!
9375ecf
to
0ca5a69
Compare
68ab336
to
3f977d3
Compare
Bitbucket Cloud Connector
This pull request introduces a new connector for Bitbucket Cloud, allowing users to index and search pull requests from their repositories. The connector can be configured to target specific repositories, all repositories within one or more projects, or an entire workspace. It also has options for retaining closed PRs for specified amount of days.
I used
Confluence
,GitHub
, andGitLab
connectors as references. It uses the Bitbucket Cloud API and includes error handling and backoff/limiting strategies.How to Test
You can test this connector using any public Bitbucket Cloud repository. For convenience, Atlassian's public repositories are a great target for testing.
API token and connector creation video.
read
permissions forProjects
,Repositories
, andPull Requests
. (see documentation PR for This connector)dokv
PEAL
(Sourcetree for Jira).You can use my own sample public repositories at https://bitbucket.org/dokv/workspace/projects/PEAL.
Summary by cubic
Add a Bitbucket Cloud connector to index pull requests. Includes scoping by workspace/project/repo, optional pruning of closed PRs, slim sync, and a UI to configure credentials.
New Features
Migration