-
Notifications
You must be signed in to change notification settings - Fork 132
Add Bitbucket support #275
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
Merged
Merged
Changes from 9 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
ff43d10
[wip] add bitbucket schema
msukkari 9fb9973
wip bitbucket support
msukkari 5c21ca7
add support for pulling bitbucket repos and UI support for bitbucket
msukkari 4f86085
fix bitbucket app password auth case
msukkari 12e2906
add back support for multiple workspaces and add exclude logic
msukkari 69fcc83
add branches to bitbucket
msukkari bcb32cd
add bitbucket server support
msukkari 4c6636d
add docs for bitbucket and minor nits
msukkari 108d609
doc nits
msukkari 53248d8
code rabbit fixes
msukkari 82c122c
fix build error
msukkari 44ce5bc
add bitbucket web ui support
msukkari aea39c6
misc cleanups and fix ui issues with bitbucket connections
msukkari 261fa8d
merge main
msukkari 1e01446
add changelog entry
msukkari File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,201 @@ | ||
--- | ||
title: Linking code from Bitbucket Cloud | ||
sidebarTitle: Bitbucket Cloud | ||
--- | ||
|
||
import BitbucketToken from '/snippets/bitbucket-token.mdx'; | ||
import BitbucketAppPassword from '/snippets/bitbucket-app-password.mdx'; | ||
|
||
## Examples | ||
|
||
<AccordionGroup> | ||
<Accordion title="Sync individual repos"> | ||
```json | ||
{ | ||
"type": "bitbucket", | ||
"deploymentType": "cloud", | ||
"repos": [ | ||
"myWorkspace/myRepo" | ||
] | ||
} | ||
``` | ||
</Accordion> | ||
<Accordion title="Sync all repos in a workspace"> | ||
```json | ||
{ | ||
"type": "bitbucket", | ||
"deploymentType": "cloud", | ||
"workspaces": [ | ||
"myWorkspace" | ||
] | ||
} | ||
``` | ||
</Accordion> | ||
<Accordion title="Sync all repos in a project"> | ||
```json | ||
{ | ||
"type": "bitbucket", | ||
"deploymentType": "cloud", | ||
"project": [ | ||
"myWorkspace/myRepo" | ||
] | ||
} | ||
``` | ||
</Accordion> | ||
<Accordion title="Exclude repos from syncing"> | ||
```json | ||
{ | ||
"type": "bitbucket", | ||
"deploymentType": "cloud", | ||
// Include all repos in my-workspace... | ||
"workspaces": [ | ||
"myWorkspace" | ||
], | ||
// ...except: | ||
"exclude": { | ||
// repos that are archived | ||
"archived": true, | ||
// repos that are forks | ||
"forks": true, | ||
// repos that match these glob patterns | ||
"repos": [ | ||
"myWorkspace/repo1", | ||
"myWorkspace2/*" | ||
] | ||
} | ||
} | ||
``` | ||
</Accordion> | ||
</AccordionGroup> | ||
|
||
## Authenticating with Bitbucket Cloud | ||
|
||
In order to index private repositories, you'll need to provide authentication credentials. You can do this using an `App Password` or an `Access Token` | ||
|
||
<Tabs> | ||
<Tab title="App Password"> | ||
Navigate to the [app password creation page](https://bitbucket.org/account/settings/app-passwords/) and create an app password. Ensure that it has the proper permissions for the scope | ||
of info you want to fetch (i.e. workspace, project, and/or repo level) | ||
 | ||
|
||
Next, provide your username + app password pair to Sourcebot: | ||
|
||
<BitbucketAppPassword /> | ||
</Tab> | ||
<Tab title="Access Token"> | ||
Create an access token for the desired scope (repo, project, or workspace). Visit the official [Bitbucket Cloud docs](https://support.atlassian.com/bitbucket-cloud/docs/access-tokens/) | ||
for more info. | ||
|
||
Next, provide the access token to Sourcebot: | ||
|
||
<BitbucketToken /> | ||
</Tab> | ||
</Tabs> | ||
|
||
|
||
## Schema reference | ||
|
||
<Accordion title="Reference"> | ||
[schemas/v3/bitbucket.json](https://github.com/sourcebot-dev/sourcebot/blob/main/schemas/v3/bitbucket.json) | ||
|
||
```json | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"type": "object", | ||
"title": "BitbucketConnectionConfig", | ||
"properties": { | ||
"type": { | ||
"const": "bitbucket", | ||
"description": "Bitbucket configuration" | ||
}, | ||
"user": { | ||
"type": "string", | ||
"description": "The username to use for authentication. Only needed if token is an app password." | ||
}, | ||
"token": { | ||
"$ref": "./shared.json#/definitions/Token", | ||
"description": "An authentication token.", | ||
"examples": [ | ||
{ | ||
"secret": "SECRET_KEY" | ||
} | ||
] | ||
}, | ||
"url": { | ||
"type": "string", | ||
"format": "url", | ||
"default": "https://api.bitbucket.org/2.0", | ||
"description": "Bitbucket URL", | ||
"examples": [ | ||
"https://bitbucket.example.com" | ||
], | ||
"pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$" | ||
}, | ||
"deploymentType": { | ||
"type": "string", | ||
"enum": ["cloud", "server"], | ||
"default": "cloud", | ||
"description": "The type of Bitbucket deployment" | ||
}, | ||
"workspaces": { | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
}, | ||
"description": "List of workspaces to sync. Ignored if deploymentType is server." | ||
}, | ||
"projects": { | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
}, | ||
"description": "List of projects to sync" | ||
}, | ||
"repos": { | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
}, | ||
"description": "List of repos to sync" | ||
}, | ||
"exclude": { | ||
"type": "object", | ||
"properties": { | ||
"archived": { | ||
"type": "boolean", | ||
"default": false, | ||
"description": "Exclude archived repositories from syncing." | ||
}, | ||
"forks": { | ||
"type": "boolean", | ||
"default": false, | ||
"description": "Exclude forked repositories from syncing." | ||
}, | ||
"repos": { | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
}, | ||
"examples": [ | ||
[ | ||
"cloud_workspace/repo1", | ||
"server_project/repo2" | ||
] | ||
], | ||
"description": "List of specific repos to exclude from syncing." | ||
} | ||
}, | ||
"additionalProperties": false | ||
}, | ||
"revisions": { | ||
"$ref": "./shared.json#/definitions/GitRevisions" | ||
} | ||
}, | ||
"required": [ | ||
"type" | ||
], | ||
"additionalProperties": false | ||
} | ||
``` | ||
|
||
</Accordion> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,180 @@ | ||
--- | ||
title: Linking code from Bitbucket Data Center | ||
sidebarTitle: Bitbucket Data Center | ||
--- | ||
|
||
import BitbucketToken from '/snippets/bitbucket-token.mdx'; | ||
import BitbucketAppPassword from '/snippets/bitbucket-app-password.mdx'; | ||
|
||
## Examples | ||
|
||
<AccordionGroup> | ||
<Accordion title="Sync individual repos"> | ||
```json | ||
{ | ||
"type": "bitbucket", | ||
"deploymentType": "server", | ||
"url": "https://mybitbucketdeployment.com" | ||
"repos": [ | ||
"myProject/myRepo" | ||
] | ||
} | ||
``` | ||
msukkari marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</Accordion> | ||
<Accordion title="Sync all repos in a project"> | ||
```json | ||
{ | ||
"type": "bitbucket", | ||
"deploymentType": "server", | ||
"url": "https://mybitbucketdeployment.com" | ||
"projects": [ | ||
"myProject" | ||
] | ||
} | ||
msukkari marked this conversation as resolved.
Show resolved
Hide resolved
|
||
``` | ||
</Accordion> | ||
<Accordion title="Exclude repos from syncing"> | ||
```json | ||
{ | ||
"type": "bitbucket", | ||
"deploymentType": "server", | ||
"url": "https://mybitbucketdeployment.com" | ||
// Include all repos in myProject... | ||
"projects": [ | ||
"myProject" | ||
], | ||
// ...except: | ||
"exclude": { | ||
// repos that are archived | ||
"archived": true, | ||
// repos that are forks | ||
"forks": true, | ||
// repos that match these glob patterns | ||
"repos": [ | ||
"myProject/repo1", | ||
"myProject2/*" | ||
] | ||
} | ||
} | ||
``` | ||
</Accordion> | ||
</AccordionGroup> | ||
|
||
## Authenticating with Bitbucket Data Center | ||
|
||
In order to index private repositories, you'll need to provide an access token to Sourcebot. | ||
|
||
Create an access token for the desired scope (repo, project, or workspace). Visit the official [Bitbucket Data Center docs](https://confluence.atlassian.com/bitbucketserver/http-access-tokens-939515499.html) | ||
for more info. | ||
|
||
Next, provide the access token to Sourcebot: | ||
|
||
<BitbucketToken /> | ||
|
||
|
||
## Schema reference | ||
|
||
<Accordion title="Reference"> | ||
[schemas/v3/bitbucket.json](https://github.com/sourcebot-dev/sourcebot/blob/main/schemas/v3/bitbucket.json) | ||
|
||
```json | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"type": "object", | ||
"title": "BitbucketConnectionConfig", | ||
"properties": { | ||
"type": { | ||
"const": "bitbucket", | ||
"description": "Bitbucket configuration" | ||
}, | ||
"user": { | ||
"type": "string", | ||
"description": "The username to use for authentication. Only needed if token is an app password." | ||
}, | ||
"token": { | ||
"$ref": "./shared.json#/definitions/Token", | ||
"description": "An authentication token.", | ||
"examples": [ | ||
{ | ||
"secret": "SECRET_KEY" | ||
} | ||
] | ||
}, | ||
"url": { | ||
"type": "string", | ||
"format": "url", | ||
"default": "https://api.bitbucket.org/2.0", | ||
"description": "Bitbucket URL", | ||
"examples": [ | ||
"https://bitbucket.example.com" | ||
], | ||
"pattern": "^https?:\\/\\/[^\\s/$.?#].[^\\s]*$" | ||
}, | ||
"deploymentType": { | ||
"type": "string", | ||
"enum": ["cloud", "server"], | ||
"default": "cloud", | ||
"description": "The type of Bitbucket deployment" | ||
}, | ||
"workspaces": { | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
}, | ||
"description": "List of workspaces to sync. Ignored if deploymentType is server." | ||
}, | ||
"projects": { | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
}, | ||
"description": "List of projects to sync" | ||
}, | ||
"repos": { | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
}, | ||
"description": "List of repos to sync" | ||
}, | ||
"exclude": { | ||
"type": "object", | ||
"properties": { | ||
"archived": { | ||
"type": "boolean", | ||
"default": false, | ||
"description": "Exclude archived repositories from syncing." | ||
}, | ||
"forks": { | ||
"type": "boolean", | ||
"default": false, | ||
"description": "Exclude forked repositories from syncing." | ||
}, | ||
"repos": { | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
}, | ||
"examples": [ | ||
[ | ||
"cloud_workspace/repo1", | ||
"server_project/repo2" | ||
] | ||
], | ||
"description": "List of specific repos to exclude from syncing." | ||
} | ||
}, | ||
"additionalProperties": false | ||
}, | ||
"revisions": { | ||
"$ref": "./shared.json#/definitions/GitRevisions" | ||
} | ||
}, | ||
"required": [ | ||
"type" | ||
], | ||
"additionalProperties": false | ||
} | ||
``` | ||
|
||
</Accordion> |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.