Skip to content

Commit e7fa4c4

Browse files
msukkaribrendan-kellamxPartyBear
authored
feat(connections): Add Azure Devops Support (#514)
* initial ado pol * add support for ado logo * default to main instead of HEAD when generating file url * bump zoekt * fix(web) Fix "At least one project, user, or group must be specified" for GitLab configs in web configurator (#512) * feat(ask_sb): Fallback on fromNodeProviderChain if access key or sessionToken are not provided (#513) * Quote branches argument in zoekt.ts to fix Pipe (#506) * remove connections settings page * fix styling and remove additional components * add changelog * add docs * fix build error * bump zoekt * fix broken links for ado docs * fix HEAD support for ado * changelog --------- Co-authored-by: Brendan Kellam <[email protected]> Co-authored-by: Michael Dekoski <[email protected]>
1 parent db6e5d4 commit e7fa4c4

34 files changed

+2488
-25
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Added
1111
- Added fallback to default the Node.JS AWS SDK's `fromNodeProviderChain` when no credentials are provided for a bedrock config. [#513](https://github.com/sourcebot-dev/sourcebot/pull/513)
12+
- Added support for Azure Devops support. [#514](https://github.com/sourcebot-dev/sourcebot/pull/514)
1213

1314
### Fixed
1415
- Fixed "At least one project, user, or group must be specified" for GitLab configs with `all` in web configurator. [#512](https://github.com/sourcebot-dev/sourcebot/pull/512)

docs/docs.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@
6868
"docs/connections/gitlab",
6969
"docs/connections/bitbucket-cloud",
7070
"docs/connections/bitbucket-data-center",
71+
"docs/connections/ado-cloud",
72+
"docs/connections/ado-server",
7173
"docs/connections/gitea",
7274
"docs/connections/gerrit",
7375
"docs/connections/generic-git-host",
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
---
2+
title: Linking code from Azure Devops Cloud
3+
sidebarTitle: Azure Devops Cloud
4+
icon: https://www.svgrepo.com/show/448307/azure-devops.svg
5+
---
6+
7+
import AzureDevopsSchema from '/snippets/schemas/v3/azuredevops.schema.mdx'
8+
9+
If you're not familiar with Sourcebot [connections](/docs/connections/overview), please read that overview first.
10+
11+
## Examples
12+
13+
<AccordionGroup>
14+
<Accordion title="Sync individual repos">
15+
```json
16+
{
17+
"type": "azuredevops",
18+
"repos": [
19+
"organizationName/projectName/repoName",
20+
"organizationName/projectName/repoName2
21+
]
22+
}
23+
```
24+
</Accordion>
25+
<Accordion title="Sync all repos in a organization">
26+
```json
27+
{
28+
"type": "azuredevops",
29+
"orgs": [
30+
"organizationName",
31+
"organizationName2
32+
]
33+
}
34+
```
35+
</Accordion>
36+
<Accordion title="Sync all repos in a project">
37+
```json
38+
{
39+
"type": "azuredevops",
40+
"projects": [
41+
"organizationName/projectName",
42+
"organizationName/projectName2"
43+
]
44+
}
45+
```
46+
</Accordion>
47+
<Accordion title="Exclude repos from syncing">
48+
```json
49+
{
50+
"type": "azuredevops",
51+
// Include all repos in my-org...
52+
"orgs": [
53+
"my-org"
54+
],
55+
// ...except:
56+
"exclude": {
57+
// repos that are disabled
58+
"disabled": true,
59+
// repos that match these glob patterns
60+
"repos": [
61+
"reposToExclude*"
62+
],
63+
// projects that match these glob patterns
64+
"projects": [
65+
"projectstoExclude*"
66+
]
67+
// repos less than the defined min OR larger than the defined max
68+
"size": {
69+
// repos that are less than 1MB (in bytes)...
70+
"min": 1048576,
71+
// or repos greater than 100MB (in bytes)
72+
"max": 104857600
73+
}
74+
}
75+
}
76+
```
77+
</Accordion>
78+
</AccordionGroup>
79+
80+
## Authenticating with Azure Devops Cloud
81+
82+
Azure Devops Cloud requires you to provide a PAT in order to index your repositories. To learn how to create PAT, check out the [Azure Devops docs](https://learn.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?view=azure-devops&tabs=Windows).
83+
Sourcebot needs the `Read` access for the `Code` scope in order to find and clone your repos.
84+
85+
Next, provide the access token via the `token` property, either as an environment variable or a secret:
86+
87+
<Tabs>
88+
<Tab title="Environment Variable">
89+
90+
1. Add the `token` property to your connection config:
91+
```json
92+
{
93+
"type": "azuredevops",
94+
"token": {
95+
// note: this env var can be named anything. It
96+
// doesn't need to be `ADO_TOKEN`.
97+
"env": "ADO_TOKEN"
98+
}
99+
// .. rest of config ..
100+
}
101+
```
102+
103+
2. Pass this environment variable each time you run Sourcebot:
104+
```bash
105+
docker run \
106+
-e ADO_TOKEN=<PAT> \
107+
/* additional args */ \
108+
ghcr.io/sourcebot-dev/sourcebot:latest
109+
```
110+
</Tab>
111+
112+
<Tab title="Secret">
113+
<Note>Secrets are only supported when [authentication](/docs/configuration/auth/overview) is enabled.</Note>
114+
115+
1. Navigate to **Secrets** in settings and create a new secret with your PAT:
116+
117+
![](/images/secrets_list.png)
118+
119+
2. Add the `token` property to your connection config:
120+
121+
```json
122+
{
123+
"type": "azuredevops",
124+
"token": {
125+
"secret": "mysecret"
126+
}
127+
// .. rest of config ..
128+
}
129+
```
130+
131+
</Tab>
132+
</Tabs>
133+
134+
## Schema reference
135+
136+
<Accordion title="Reference">
137+
[schemas/v3/azuredevops.json](https://github.com/sourcebot-dev/sourcebot/blob/main/schemas/v3/azuredevops.json)
138+
139+
<AzureDevopsSchema />
140+
141+
</Accordion>
Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
---
2+
title: Linking code from Azure Devops Server
3+
sidebarTitle: Azure Devops Server
4+
icon: https://www.svgrepo.com/show/448307/azure-devops.svg
5+
---
6+
7+
import AzureDevopsSchema from '/snippets/schemas/v3/azuredevops.schema.mdx'
8+
9+
If you're not familiar with Sourcebot [connections](/docs/connections/overview), please read that overview first.
10+
11+
## Examples
12+
13+
<AccordionGroup>
14+
<Accordion title="Enable TFS path support">
15+
This is required if you're using an older version of ADO Server which has `/tfs` in the repo paths.
16+
```json
17+
{
18+
"type": "azuredevops",
19+
"useTfsPath": true
20+
"repos": [
21+
"organizationName/projectName/repoName",
22+
"organizationName/projectName/repoName2
23+
]
24+
}
25+
```
26+
</Accordion>
27+
<Accordion title="Sync individual repos">
28+
```json
29+
{
30+
"type": "azuredevops",
31+
"repos": [
32+
"organizationName/projectName/repoName",
33+
"organizationName/projectName/repoName2
34+
]
35+
}
36+
```
37+
</Accordion>
38+
<Accordion title="Sync all repos in a collection">
39+
```json
40+
{
41+
"type": "azuredevops",
42+
"orgs": [
43+
"collectionName",
44+
"collectionName2"
45+
]
46+
}
47+
```
48+
</Accordion>
49+
<Accordion title="Sync all repos in a project">
50+
```json
51+
{
52+
"type": "azuredevops",
53+
"projects": [
54+
"collectionName/projectName",
55+
"collectionName/projectName2"
56+
]
57+
}
58+
```
59+
</Accordion>
60+
<Accordion title="Exclude repos from syncing">
61+
```json
62+
{
63+
"type": "azuredevops",
64+
// Include all repos in my-org...
65+
"orgs": [
66+
"my-org"
67+
],
68+
// ...except:
69+
"exclude": {
70+
// repos that are disabled
71+
"disabled": true,
72+
// repos that match these glob patterns
73+
"repos": [
74+
"reposToExclude*"
75+
],
76+
// projects that match these glob patterns
77+
"projects": [
78+
"projectstoExclude*"
79+
]
80+
// repos less than the defined min OR larger than the defined max
81+
"size": {
82+
// repos that are less than 1MB (in bytes)...
83+
"min": 1048576,
84+
// or repos greater than 100MB (in bytes)
85+
"max": 104857600
86+
}
87+
}
88+
}
89+
```
90+
</Accordion>
91+
</AccordionGroup>
92+
93+
## Authenticating with Azure Devops Server
94+
95+
Azure Devops Server requires you to provide a PAT in order to index your repositories. To learn how to create PAT, check out the [Azure Devops docs](https://learn.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?view=azure-devops&tabs=Windows).
96+
Sourcebot needs the `Read` access for the `Code` scope in order to find and clone your repos.
97+
98+
Next, provide the access token via the `token` property, either as an environment variable or a secret:
99+
100+
<Tabs>
101+
<Tab title="Environment Variable">
102+
103+
1. Add the `token` property to your connection config:
104+
```json
105+
{
106+
"type": "azuredevops",
107+
"token": {
108+
// note: this env var can be named anything. It
109+
// doesn't need to be `ADO_TOKEN`.
110+
"env": "ADO_TOKEN"
111+
}
112+
// .. rest of config ..
113+
}
114+
```
115+
116+
2. Pass this environment variable each time you run Sourcebot:
117+
```bash
118+
docker run \
119+
-e ADO_TOKEN=<PAT> \
120+
/* additional args */ \
121+
ghcr.io/sourcebot-dev/sourcebot:latest
122+
```
123+
</Tab>
124+
125+
<Tab title="Secret">
126+
<Note>Secrets are only supported when [authentication](/docs/configuration/auth/overview) is enabled.</Note>
127+
128+
1. Navigate to **Secrets** in settings and create a new secret with your PAT:
129+
130+
![](/images/secrets_list.png)
131+
132+
2. Add the `token` property to your connection config:
133+
134+
```json
135+
{
136+
"type": "azuredevops",
137+
"token": {
138+
"secret": "mysecret"
139+
}
140+
// .. rest of config ..
141+
}
142+
```
143+
144+
</Tab>
145+
</Tabs>
146+
147+
## Schema reference
148+
149+
<Accordion title="Reference">
150+
[schemas/v3/azuredevops.json](https://github.com/sourcebot-dev/sourcebot/blob/main/schemas/v3/azuredevops.json)
151+
152+
<AzureDevopsSchema />
153+
154+
</Accordion>

docs/docs/connections/gitea.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ Next, provide the access token via the `token` property, either as an environmen
8585

8686
<Tabs>
8787
<Tab title="Environment Variable">
88-
<Note>Environment variables are only supported in a [declarative config](/docs/configuration/declarative-config) and cannot be used in the web UI.</Note>
8988

9089
1. Add the `token` property to your connection config:
9190
```json

docs/docs/connections/github.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ Next, provide the access token via the `token` property, either as an environmen
132132

133133
<Tabs>
134134
<Tab title="Environment Variable">
135-
<Note>Environment variables are only supported in a [declarative config](/docs/configuration/declarative-config) and cannot be used in the web UI.</Note>
136135

137136
1. Add the `token` property to your connection config:
138137
```json

docs/docs/connections/gitlab.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ Next, provide the PAT via the `token` property, either as an environment variabl
120120

121121
<Tabs>
122122
<Tab title="Environment Variable">
123-
<Note>Environment variables are only supported in a [declarative config](/docs/configuration/declarative-config) and cannot be used in the web UI.</Note>
124123

125124
1. Add the `token` property to your connection config:
126125
```json

docs/images/ado.svg

Lines changed: 3 additions & 0 deletions
Loading

docs/snippets/bitbucket-app-password.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<Tabs>
22
<Tab title="Environment Variable">
3-
<Note>Environment variables are only supported in a [declarative config](/docs/configuration/declarative-config) and cannot be used in the web UI.</Note>
43

54
1. Add the `token` and `user` (username associated with the app password you created) properties to your connection config:
65
```json

docs/snippets/bitbucket-token.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<Tabs>
22
<Tab title="Environment Variable">
3-
<Note>Environment variables are only supported in a [declarative config](/docs/configuration/declarative-config) and cannot be used in the web UI.</Note>
43

54
1. Add the `token` property to your connection config:
65
```json

0 commit comments

Comments
 (0)