/
bitbucket_server.schema.json
266 lines (266 loc) · 13.8 KB
/
bitbucket_server.schema.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "bitbucket_server.schema.json#",
"title": "BitbucketServerConnection",
"description": "Configuration for a connection to Bitbucket Server / Bitbucket Data Center.",
"allowComments": true,
"type": "object",
"additionalProperties": false,
"required": ["username", "url"],
"oneOf": [
{
"required": ["token"],
"properties": {
"password": { "type": "null" }
}
},
{
"required": ["password"],
"properties": {
"token": { "type": "null" }
}
}
],
"properties": {
"rateLimit": {
"description": "Rate limit applied when making background API requests to BitbucketServer.",
"title": "BitbucketServerRateLimit",
"type": "object",
"required": ["enabled", "requestsPerHour"],
"properties": {
"enabled": {
"description": "true if rate limiting is enabled.",
"type": "boolean",
"default": true
},
"requestsPerHour": {
"description": "Requests per hour permitted. This is an average, calculated per second. Internally, the burst limit is set to 500, which implies that for a requests per hour limit as low as 1, users will continue to be able to send a maximum of 500 requests immediately, provided that the complexity cost of each request is 1.",
"type": "number",
"default": 28800,
"minimum": 0
}
},
"default": {
"enabled": true,
"requestsPerHour": 28800
}
},
"url": {
"description": "URL of a Bitbucket Server / Bitbucket Data Center instance, such as https://bitbucket.example.com.",
"type": "string",
"pattern": "^https?://",
"not": {
"type": "string",
"pattern": "example\\.com"
},
"format": "uri",
"examples": ["https://bitbucket.example.com"]
},
"token": {
"description": "A Bitbucket Server / Bitbucket Data Center personal access token with Read permissions. When using batch changes, the token needs Write permissions. Create one at https://[your-bitbucket-hostname]/plugins/servlet/access-tokens/add. Also set the corresponding \"username\" field.\n\nFor Bitbucket Server / Bitbucket Data Center instances that don't support personal access tokens (Bitbucket Server / Bitbucket Data Center version 5.4 and older), specify user-password credentials in the \"username\" and \"password\" fields.",
"type": "string",
"minLength": 1
},
"username": {
"description": "The username to use when authenticating to the Bitbucket Server / Bitbucket Data Center instance. Also set the corresponding \"token\" or \"password\" field.",
"type": "string"
},
"password": {
"description": "The password to use when authenticating to the Bitbucket Server / Bitbucket Data Center instance. Also set the corresponding \"username\" field.\n\nFor Bitbucket Server / Bitbucket Data Center instances that support personal access tokens (Bitbucket Server / Bitbucket Data Center version 5.5 and newer), it is recommended to provide a token instead (in the \"token\" field).",
"type": "string"
},
"gitURLType": {
"description": "The type of Git URLs to use for cloning and fetching Git repositories on this Bitbucket Server / Bitbucket Data Center instance.\n\nIf \"http\", Sourcegraph will access Bitbucket Server / Bitbucket Data Center repositories using Git URLs of the form http(s)://bitbucket.example.com/scm/myproject/myrepo.git (using https: if the Bitbucket Server / Bitbucket Data Center instance uses HTTPS).\n\nIf \"ssh\", Sourcegraph will access Bitbucket Server / Bitbucket Data Center repositories using Git URLs of the form ssh://git@example.bitbucket.org/myproject/myrepo.git. See the documentation for how to provide SSH private keys and known_hosts: https://sourcegraph.com/docs/admin/repo/auth.",
"type": "string",
"enum": ["http", "ssh"],
"default": "http",
"examples": ["ssh"]
},
"certificate": {
"description": "TLS certificate of the Bitbucket Server / Bitbucket Data Center instance. This is only necessary if the certificate is self-signed or signed by an internal CA. To get the certificate run `openssl s_client -connect HOST:443 -showcerts < /dev/null 2> /dev/null | openssl x509 -outform PEM`. To escape the value into a JSON string, you may want to use a tool like https://json-escape-text.now.sh.",
"type": "string",
"pattern": "^-----BEGIN CERTIFICATE-----\n",
"examples": ["-----BEGIN CERTIFICATE-----\n..."]
},
"webhooks": {
"description": "DEPRECATED: Switch to \"plugin.webhooks\"",
"type": "object",
"properties": {
"secret": {
"description": "Secret for authenticating incoming webhook payloads",
"type": "string",
"minLength": 1
}
}
},
"plugin": {
"title": "BitbucketServerPlugin",
"description": "Configuration for Bitbucket Server / Bitbucket Data Center Sourcegraph plugin",
"type": "object",
"properties": {
"webhooks": {
"title": "BitbucketServerPluginWebhooks",
"deprecationMessage": "Deprecated in favour of first class webhooks. See https://sourcegraph.com/docs/admin/config/webhooks/incoming#deprecation-notice",
"type": "object",
"required": ["secret"],
"properties": {
"secret": {
"description": "Secret for authenticating incoming webhook payloads",
"type": "string",
"minLength": 1
},
"disableSync": {
"description": "Disallow Sourcegraph from automatically syncing webhook config with the Bitbucket Server / Bitbucket Data Center instance. For details of how the webhook is configured, see our docs: https://sourcegraph.com/docs/admin/external_service/bitbucket_server#webhooks",
"type": "boolean",
"default": false
}
}
},
"permissions": {
"description": "Enables fetching Bitbucket Server / Bitbucket Data Center permissions through the roaring bitmap endpoint. Warning: there may be performance degradation under significant load.",
"type": "string",
"enum": ["enabled", "disabled"],
"default": "disabled"
}
}
},
"repositoryPathPattern": {
"description": "The pattern used to generate the corresponding Sourcegraph repository name for a Bitbucket Server / Bitbucket Data Center repository.\n\n - \"{host}\" is replaced with the Bitbucket Server / Bitbucket Data Center URL's host (such as bitbucket.example.com)\n - \"{projectKey}\" is replaced with the Bitbucket repository's parent project key (such as \"PRJ\")\n - \"{repositorySlug}\" is replaced with the Bitbucket repository's slug key (such as \"my-repo\").\n\nFor example, if your Bitbucket Server / Bitbucket Data Center is https://bitbucket.example.com and your Sourcegraph is https://src.example.com, then a repositoryPathPattern of \"{host}/{projectKey}/{repositorySlug}\" would mean that a Bitbucket Server / Bitbucket Data Center repository at https://bitbucket.example.com/projects/PRJ/repos/my-repo is available on Sourcegraph at https://src.example.com/bitbucket.example.com/PRJ/my-repo.\n\nIt is important that the Sourcegraph repository name generated with this pattern be unique to this code host. If different code hosts generate repository names that collide, Sourcegraph's behavior is undefined.",
"type": "string",
"default": "{host}/{projectKey}/{repositorySlug}",
"examples": ["{projectKey}/{repositorySlug}"]
},
"excludePersonalRepositories": {
"description": "Whether or not personal repositories should be excluded or not. When true, Sourcegraph will ignore personal repositories it may have access to. See https://sourcegraph.com/docs/integration/bitbucket_server#excluding-personal-repositories for more information.",
"type": "boolean",
"default": false
},
"repositoryQuery": {
"description": "An array of strings specifying which repositories to mirror on Sourcegraph. Each string is a URL query string with parameters that filter the list of returned repos. Examples: \"?name=my-repo&projectname=PROJECT&visibility=private\".\n\nThe special string \"none\" can be used as the only element to disable this feature. Repositories matched by multiple query strings are only imported once. Here's the official Bitbucket Server / Bitbucket Data Center documentation about which query string parameters are valid: https://docs.atlassian.com/bitbucket-server/rest/6.1.2/bitbucket-rest.html#idp355",
"type": "array",
"items": {
"type": "string",
"minLength": 1
},
"default": ["none"],
"minItems": 1,
"examples": [["?name=my-repo&projectname=PROJECT&visibility=private"]]
},
"repos": {
"description": "An array of repository \"projectKey/repositorySlug\" strings specifying repositories to mirror on Sourcegraph.",
"type": "array",
"minItems": 1,
"items": {
"type": "string",
"pattern": "^~?[\\w-]+/[\\w.-]+$"
},
"examples": [["myproject/myrepo", "myproject/myotherrepo", "~USER/theirrepo"]]
},
"projectKeys": {
"description": "An array of project key strings that defines a collection of repositories related to their associated project keys",
"type": "array",
"items": {
"type": "string"
}
},
"exclude": {
"description": "A list of repositories to never mirror from this Bitbucket Server / Bitbucket Data Center instance. Takes precedence over \"repos\" and \"repositoryQuery\".\n\nSupports excluding by name ({\"name\": \"projectKey/repositorySlug\"}) or by ID ({\"id\": 42}).",
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"title": "ExcludedBitbucketServerRepo",
"additionalProperties": false,
"anyOf": [{ "required": ["name"] }, { "required": ["id"] }, { "required": ["pattern"] }],
"properties": {
"name": {
"description": "The name of a Bitbucket Server / Bitbucket Data Center repo (\"projectKey/repositorySlug\") to exclude from mirroring.",
"type": "string",
"pattern": "^~?[\\w-]+/[\\w.-]+$"
},
"id": {
"description": "The ID of a Bitbucket Server / Bitbucket Data Center repo (as returned by the Bitbucket Server / Bitbucket Data Center instance's API) to exclude from mirroring.",
"type": "integer"
},
"pattern": {
"description": "Regular expression which matches against the name of a Bitbucket Server / Bitbucket Data Center repo.",
"type": "string",
"format": "regex"
}
}
},
"examples": [
[{ "name": "myproject/myrepo" }, { "id": 42 }],
[
{ "name": "myproject/myrepo" },
{ "name": "myproject/myotherrepo" },
{ "name": "~USER/theirrepo" },
{ "pattern": "^topsecretproject/.*" }
]
]
},
"initialRepositoryEnablement": {
"description": "Deprecated and ignored field which will be removed entirely in the next release. BitBucket repositories can no longer be enabled or disabled explicitly.",
"type": "boolean",
"default": false
},
"authorization": {
"title": "BitbucketServerAuthorization",
"description": "If non-null, enforces Bitbucket Server / Bitbucket Data Center repository permissions.",
"type": "object",
"additionalProperties": false,
"required": ["identityProvider", "oauth"],
"properties": {
"identityProvider": {
"description": "The source of identity to use when computing permissions. This defines how to compute the Bitbucket Server / Bitbucket Data Center identity to use for a given Sourcegraph user. When 'username' is used, Sourcegraph assumes usernames are identical in Sourcegraph and Bitbucket Server / Bitbucket Data Center accounts and `auth.enableUsernameChanges` must be set to false for security reasons.",
"title": "BitbucketServerIdentityProvider",
"type": "object",
"required": ["type"],
"properties": {
"type": {
"type": "string",
"enum": ["username"]
}
},
"oneOf": [{ "$ref": "#/definitions/UsernameIdentity" }],
"!go": {
"taggedUnionType": true
}
},
"oauth": {
"title": "BitbucketServerOAuth",
"type": "object",
"additionalProperties": false,
"required": ["consumerKey", "signingKey"],
"description": "OAuth configuration specified when creating the Bitbucket Server / Bitbucket Data Center Application Link with incoming authentication. Two Legged OAuth with 'ExecuteAs=admin' must be enabled as well as user impersonation.",
"properties": {
"consumerKey": {
"description": "The OAuth consumer key specified when creating the Bitbucket Server / Bitbucket Data Center Application Link with incoming authentication.",
"type": "string",
"minLength": 1
},
"signingKey": {
"description": "Base64 encoding of the OAuth PEM encoded RSA private key used to generate the public key specified when creating the Bitbucket Server / Bitbucket Data Center Application Link with incoming authentication.",
"type": "string",
"minLength": 1
}
}
}
}
}
},
"definitions": {
"UsernameIdentity": {
"title": "BitbucketServerUsernameIdentity",
"type": "object",
"additionalProperties": false,
"required": ["type"],
"properties": {
"type": {
"type": "string",
"const": "username"
}
}
}
}
}