-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathopenapi_sonar_6.x.yaml
More file actions
executable file
·1064 lines (1042 loc) · 38.3 KB
/
openapi_sonar_6.x.yaml
File metadata and controls
executable file
·1064 lines (1042 loc) · 38.3 KB
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
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: 3.0.1
info:
title: Include Code Quality for Bitbucket 6.x REST API
description: |-
The REST API for [Include Code Quality for Bitbucket](https://marketplace.atlassian.com/apps/1212735) (formerly Sonar™ for Bitbucket) allows you to
- Configure SonarQube™ server connections
- Configure plug-in settings on projects and repositories
- Configure SonarQube™ project mappings to repositories
- Set SonarQube™ user tokens
**Need support?** take a look at our [wiki](https://mibexsoftware.atlassian.net/l/c/tsBUTXF9) or contact us under [support@mibexsoftware.com](support@mibexsoftware.com)
SONAR™, SONARQUBE™ and SONARCLOUD™ are independent and trademarked products and services of SonarSource SA: see [sonarsource.com](https://sonarsource.com), [sonarqube.org](https://sonarqube.org), [sonarcloud.io](https://sonarcloud.io).
contact:
name: Mibex Software GmbH
url: https://www.mibexsoftware.com
license:
name: Copyright (c) 2022 by Mibex Software GmbH, Switzerland. All rights reserved.
url: https://mibexsoftware.com/imprint/
version: v1
servers:
- url: https://{YOUR_BITBUCKET_SERVER}/rest/sonar4stash/1.0
variables:
YOUR_BITBUCKET_SERVER:
default: localhost:7990/bitbucket
description: The Bitbucket Base URL
tags:
- name: Project settings
description: Create or modify projects settings for the plug-in
- name: Repository settings
description: Create or modify repository settings for the plug-in
- name: SonarQube™ server configurations
description: Create or modify your connections to SonarQube™ servers
- name: SonarQube™ user token configuration
description: Control you SonarQube™ user token
- name: SonarQube™ project mappings
description: Configure mappings from SonarQube™ projects to repositories
paths:
/projects/{projectKey}/repos/{repositorySlug}/settings:
get:
tags:
- Repository settings
summary: Returns the repository settings of the plug-in.
operationId: getRepositorySettings
parameters:
- name: projectKey
in: path
required: true
schema:
type: string
- name: repositorySlug
in: path
required: true
schema:
type: string
responses:
200:
description: Repository settings found
content:
application/json:
schema:
$ref: "#/components/schemas/RestRepoConfig"
401:
description: The currently authenticated user does not have REPO_ADMIN permissions
404:
description: The given repository does not exist or there are no settings
for this repository
post:
tags:
- Repository settings
summary: Creates or updates the repository settings for the plug-in.
operationId: createOrUpdateRepositorySettings
parameters:
- name: projectKey
in: path
required: true
schema:
type: string
- name: repositorySlug
in: path
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/RestRepoConfig'
required: true
responses:
200:
description: Repository settings saved
content:
application/json:
schema:
$ref: "#/components/schemas/RestRepoConfig"
400:
description: Invalid parameters or mandatory parameters not passed
401:
description: The currently authenticated user does not have REPO_ADMIN permissions
404:
description: The given repository does not exist or there are no settings
for this repository
delete:
tags:
- Repository settings
summary: Deletes repository settings for the plug-in.
operationId: deleteRepositorySettings
parameters:
- name: projectKey
in: path
required: true
schema:
type: string
- name: repositorySlug
in: path
required: true
schema:
type: string
responses:
200:
description: Repository configuration deleted
401:
description: The currently authenticated user does not have REPO_ADMIN permissions
404:
description: The given repository does not exist or there are no settings
for this repository
/projects/{projectKey}/repos/{repositorySlug}/sonar-projects:
get:
tags:
- "SonarQube™ project mappings"
summary: "Returns all SonarQube™ projects mapped to a repository"
description: ""
operationId: "getSonarProjectMappings"
parameters:
- name: "projectKey"
in: "path"
required: true
schema:
type: "string"
- name: "repositorySlug"
in: "path"
required: true
schema:
type: "string"
responses:
200:
description: "SonarQube™ project mappings for the repository"
content:
application/json:
schema:
$ref: "#/components/schemas/RestSonarProjectsResponse"
401:
description: "The currently authenticated user does not have REPO_ADMIN\
\ credentials"
404:
description: "The specified repository/project does not exit"
post:
tags:
- "SonarQube™ project mappings"
summary: "Create SonarQube™ project mapping"
description: ""
operationId: "createSonarProjectMapping"
parameters:
- name: "projectKey"
in: "path"
required: true
schema:
type: "string"
- name: "repositorySlug"
in: "path"
required: true
schema:
type: "string"
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/RestSonarProject"
required: true
responses:
200:
description: "SonarQube™ project mapping created"
content:
application/json:
schema:
$ref: "#/components/schemas/RestSonarProjectResponse"
400:
description: "The SonarQube™ project mapping could not be validated"
401:
description: "The currently authenticated user does not have REPO_ADMIN\
\ credentials"
404:
description: "The repository, project or SonarQube™ project mapping does\
\ not exist"
put:
tags:
- "SonarQube™ project mappings"
summary: "Update SonarQube™ project mapping"
description: ""
operationId: "updateSonarProjectMapping"
parameters:
- name: "projectKey"
in: "path"
required: true
schema:
type: "string"
- name: "repositorySlug"
in: "path"
required: true
schema:
type: "string"
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/RestSonarProject"
responses:
200:
description: "SonarQube™ project mapping updated"
content:
application/json:
schema:
$ref: "#/components/schemas/RestSonarProjectResponse"
400:
description: "The SonarQube™ project mapping could not be validated"
401:
description: "The currently authenticated user does not have REPO_ADMIN\
\ credentials"
404:
description: "The repository, project or SonarQube™ project mapping does\
\ not exist"
/projects/{projectKey}/repos/{repositorySlug}/sonar-projects/{sonarProjectId}:
delete:
tags:
- "SonarQube™ project mappings"
summary: "Deletes a SonarQube™ project mapping from a repository."
description: ""
operationId: "deleteSonarProjectMapping"
parameters:
- name: "projectKey"
in: "path"
required: true
schema:
type: "string"
- name: "repositorySlug"
in: "path"
required: true
schema:
type: "string"
- name: "sonarProjectId"
in: "path"
required: true
schema:
type: "string"
responses:
200:
description: "SonarQube™ project mapping deleted"
401:
description: "The currently authenticated user does not have REPO_ADMIN\
\ credentials"
404:
description: "The repository, project or SonarQube™ project mapping does\
\ not exist"
/projects/{projectKey}/settings:
get:
tags:
- Project settings
summary: Returns the project settings of the plug-in.
operationId: getProjectSettings
parameters:
- name: projectKey
in: path
required: true
schema:
type: string
responses:
200:
description: Project settings found
content:
application/json:
schema:
$ref: "#/components/schemas/RestProjectConfig"
401:
description: The currently authenticated user does not have PROJECT_ADMIN
permissions
content: {}
404:
description: The given project does not exist or there are no settings for
this project
content: {}
post:
tags:
- Project settings
summary: Creates or updates project settings for the plug-in.
operationId: createOrUpdateProjectSettings
parameters:
- name: projectKey
in: path
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/RestProjectConfig'
required: true
responses:
200:
description: Project settings saved
content:
application/json:
schema:
$ref: "#/components/schemas/RestProjectConfig"
400:
description: Invalid parameters or mandatory parameters not passed
401:
description: The currently authenticated user does not have PROJECT_ADMIN permissions
404:
description: The given project does not exist or there are no settings for
this project
delete:
tags:
- Project settings
summary: Deletes project settings for the plug-in.
operationId: deleteProjectSettings
parameters:
- name: projectKey
in: path
required: true
schema:
type: string
responses:
200:
description: Project configuration deleted
401:
description: The currently authenticated user does not have PROJECT_ADMIN permissions
404:
description: The given project does not exist or there are no settings for this project
/sonar-server-configs:
get:
tags:
- SonarQube™ server configurations
summary: Returns the SonarQube™ server configurations.
operationId: getSonarServerConfigurations
responses:
200:
description: SonarQube™ server configurations found
content:
application/json:
schema:
$ref: "#/components/schemas/RestSonarServerConfigs"
401:
description: The currently authenticated user does not have ADMIN credentials
put:
tags:
- SonarQube™ server configurations
summary: Updates a SonarQube™ server configuration.
operationId: updateSonarServerConfiguration
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/RestAdminConfig'
required: true
responses:
200:
description: SonarQube™ server configuration updated
content:
application/json:
schema:
$ref: "#/components/schemas/RestAdminResponse"
401:
description: The currently authenticated user does not have ADMIN credentials
404:
description: The SonarQube™ server configuration does not exist
post:
tags:
- SonarQube™ server configurations
summary: Creates a SonarQube™ server configuration.
operationId: createSonarServerConfiguration
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/RestAdminConfig'
required: true
responses:
200:
description: SonarQube™ server configuration added
content:
application/json:
schema:
$ref: "#/components/schemas/RestAdminResponse"
400:
description: A validation error for the given input occurred
401:
description: The currently authenticated user does not have ADMIN credentials
delete:
tags:
- SonarQube™ server configurations
summary: Deletes a SonarQube™ server configuration.
operationId: deleteSonarServerConfiguration
parameters:
- name: id
in: query
required: true
schema:
type: integer
format: int32
- name: fallbackServerId
in: query
description: Fallback server id which is assigned to repositories that use this server
schema:
type: integer
format: int32
- name: removeRepoConfig
in: query
description: Deletes all SonarQube™ repository configurations that use this server
schema:
type: boolean
responses:
200:
description: SonarQube™ server configuration deleted
400:
description: The arguments are not valid. Either a valid fallbackServerId
or removeRepoConfig is required
401:
description: The currently authenticated user does not have ADMIN credentials
404:
description: The SonarQube™ server configuration does not exist
/sonar-server-configs/edition:
get:
tags:
- SonarQube™ server configurations
summary: Get SonarQube™ server edition.
operationId: getSonarQubeEdition
responses:
200:
description: Fetched SonarQube™ server edition
content:
application/json:
schema:
type: string
enum:
- COMMUNITY_EDITION
- COMMUNITY_EDITION_BRANCH
- COMMERCIAL_EDITION
401:
description: The currently authenticated user does not have ADMIN credentials
404:
description: The SonarQube™ server configuration does not exist
500:
description: Error fetching the onarQube server edition
/sonar-server-configs/repos-using-sonar-server:
get:
tags:
- SonarQube™ server configurations
summary: Returns a list of repos using a SonarQube™ config
operationId: getReposUsingSonarServer
parameters:
- name: id
in: query
required: true
schema:
type: integer
format: int32
responses:
200:
description: All repositories that are used by this SonarQube™ server
content:
application/json:
schema:
$ref: "#/components/schemas/ReposUsingSonarServer"
401:
description: The currently authenticated user does not have ADMIN credentials
404:
description: SonarQube™ server not found
/user-tokens/{userSlug}:
get:
tags:
- SonarQube™ user token configuration
summary: Returns the SonarQube™ user tokens for a specific Bitbucket user.
operationId: getUserTokens
parameters:
- name: userSlug
in: path
required: true
schema:
type: string
responses:
200:
description: SonarQube™ user tokens returned
content:
application/json:
schema:
$ref: "#/components/schemas/RestUserTokens"
401:
description: The authenticated user does not match the one tokens are requested for
put:
tags:
- SonarQube™ user token configuration
summary: Updates a SonarQube™ user token configuration.
operationId: updateUserToken
parameters:
- name: userSlug
in: path
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/RestUserToken'
required: true
responses:
200:
description: SonarQube™ user token configuration updated
content:
application/json:
schema:
$ref: "#/components/schemas/RestUserTokenResponse"
400:
description: A validation error for the given input occurred
401:
description: The authenticated user does not match the one tokens are requested for
404:
description: The SonarQube™ user does not exist
post:
tags:
- SonarQube™ user token configuration
summary: Creates a SonarQube™ user token configuration.
operationId: addUserToken
parameters:
- name: userSlug
in: path
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/RestUserToken'
required: true
responses:
200:
description: SonarQube™ user token configuration created
content:
application/json:
schema:
$ref: "#/components/schemas/RestUserTokenResponse"
400:
description: A validation error for the given input occurred
401:
description: The authenticated user does not match the one tokens are requested for
404:
description: The SonarQube™ user does not exist
delete:
tags:
- SonarQube™ user token configuration
summary: Deletes a SonarQube™ user token configuration.
operationId: deleteUserToken
parameters:
- name: userSlug
in: path
required: true
schema:
type: string
- name: id
in: query
schema:
type: integer
format: int32
responses:
200:
description: SonarQube™ user token configuration deleted
401:
description: The authenticated user does not match the one tokens are requested for
404:
description: The SonarQube™ user does not exist
components:
schemas:
RestAdminConfig:
type: object
properties:
name:
type: string
description: Give a name to your server configuration to reference it.
description:
type: string
description: An optional text to describe this server configuration.
sonarServerUrl:
type: string
description: URL of your SonarQube™ server instance (e.g., "http://192.168.1.27:9000" or "https://sonarcloud.io").
sonarDisplayUrl:
type: string
description: The display URL is used when rendering links to the SonarQube™ server in the user's
browser. Should only be different to the Application URL if your Bitbucket cannot access the
internet directly (e.g. behind a firewall or proxy), otherwise leave empty.
sonarQubeEdition:
type: string
description: The SonarQube™ edition of the server
enum:
- COMMUNITY_EDITION
- COMMUNITY_EDITION_BRANCH
- COMMERCIAL_EDITION
sonarOrganizationKey:
type: string
description: This is the organization key for your SonarCloud™ account.
sonarLogin:
type: string
deprecated: true
description: |
Deprecated: use sonarUserToken
sonarPassword:
type: string
deprecated: true
description: |
Deprecated: use sonarUserToken
sonarUserToken:
type: string
description: Enter SonarQube™ user token of Service Account. Leave empty if anonymous login is allowed.
allowUserTokens:
type: boolean
description: Allow users to use their own SonarQube™ account when making
requests to this SonarQube™ server from Bitbucket.
invalidWebhookState:
type: string
description: 'OPTIONAL: State of webhook configuration if not valid for
this app in the SonarQube™ server'
requireUserTokensType:
type: string
description: |
Only considerdd if `allowUserTokens` is `true`
- `NOT_REQUIRED`: optional personal user tokens
- `REQUIRE_WRITABLE_ACTIONS`: required personal user tokens **for write actions**
- `REQUIRE_ALL_ACTIONS`: required for all SonarQube™ actions
enum:
- NOT_REQUIRED
- REQUIRE_ALL_ACTIONS
- REQUIRE_WRITABLE_ACTIONS
illegalBranchReplacement:
type: string
description: |
- Ony for community editions: SonarQube™ forbids using certain characters in project keys which may be present in branch names.
- Allowed characters in SonarQube™ project keys: [0-9a-zA-Z:\\-_.:]. Therefore, a "/" which is typically used in Git branch naming patterns (e.g., features/user-story-xyz) must be replaced by the provided character here.
- Make sure that this project key replacement character matches the one in your build system (e.g., Include Code Quality for Bamboo).
manualWebhookEnabled:
type: boolean
description: |
Enble this option for manual webhook configuration and create a [webhook as described on our Wiki page manually](https://mibexsoftware.atlassian.net/wiki/spaces/MSS/pages/2315911173/Configure+Webhook+in+SonarQube#Manual-webhook-setup)
with name: `ch.mibex.bitbucket.sonar` and URL: `https://YOUR_BITBUCKET/rest/sonar4stash/1.0/webhook/secret`
manualWebhookSecret:
type: string
writeOnly: true
description: The secret for the manual webhook from SonarQube™.
id:
type: integer
default: null
description: ID of the referenced server configuration. Only necessary when
updating/deleting a configuration.
format: int32
RestSonarServerConfigs:
type: array
items:
type: object
properties:
sonarServerConfigs:
$ref: "#/components/schemas/RestAdminConfig"
RestAdminResponse:
type: object
properties:
sonarServerConfig:
$ref: "#/components/schemas/RestAdminConfig"
ReposUsingSonarServer:
type: object
properties:
name:
type: string
description: Repository name
link:
type: string
description: Link to plug-in settings of this repository
RestProjectConfig:
required:
- duplicateCode
- issues
- mergeChecks
- project
- provisioning
- statistics
- testCoverage
type: object
properties:
project:
$ref: '#/components/schemas/RestProjectSonarProjectConfig'
issues:
$ref: '#/components/schemas/RestRepoIssueConfig'
duplicateCode:
$ref: '#/components/schemas/RestRepoDuplicateCodeConfig'
testCoverage:
$ref: '#/components/schemas/RestRepoTestCoverageConfig'
statistics:
$ref: '#/components/schemas/RestRepoStatisticsConfig'
mergeChecks:
$ref: '#/components/schemas/RestRepoMergeCheckConfig'
provisioning:
$ref: '#/components/schemas/RestRepoProvisioningConfig'
RestProjectSonarProjectConfig:
type: object
properties:
showIssuesInSource:
type: boolean
default: true
description: When enabled, SonarQube™ issues and coverage will
be shown in the Bitbucket source file view as well.
illegalBranchCharReplacement:
type: string
deprecated: true
description: 'UNUSED: use illegalBranchCharReplacement setting on SonarQube™ server configuration '
branchPrefix:
type: string
description: Only necessary if you have SonarQube™ project keys where the branch
name differs from the one in Bitbucket. If you have a branch key like
"origin/branch" in your SonarQube™ project key, you therefore might want to
set this field to "origin/".
pullRequestBranch:
type: string
description: Only necessary if you want to use the special pull request branches `refs/pull-requests/*/from`
instead of the source branch of the pull request to get data from SonarQube™.
This might be useful if you only build & analyze pull request branches,
but not the source branch of the pull request. Use values like `refs/pull-requests/%d/from`
or `pull-requests/%d` and the app will replace "%d" with the actual pull
request ID. Note that you must not enable this if you want to use pull
request analysis of commercial SonarQube™ editions or SonarCloud™ .
projectCleanupEnabled:
type: boolean
default: false
description: Deletes a SonarQube™ project when its corresponding branch is deleted
in Bitbucket (avoids to clutter up SonarQube™ when a lot of SonarQube™ projects
are created due to code reviews with branches).
forkCleanupEnabled:
type: boolean
default: false
description: |
Deletesa SonarQube™ project for a deleted branch in a repository fork (CAUTION: such
a project might be referenced from the origin repository and other forks,
therefore make sure that you really want this).
matchingBranchesRegex:
type: string
description: |
The app will only be enabled for pull requests with source branches matching this regular
expression. Example for only analyzing feature branches: `feature/.*` You
can also use negative patterns like `((?!feature/).)*` to enable it for
everything except feature branches.
RestRepoConfig:
required:
- duplicateCode
- issues
- mergeChecks
- project
- provisioning
- statistics
- testCoverage
type: object
properties:
project:
$ref: '#/components/schemas/RestRepoProjectConfig'
issues:
$ref: '#/components/schemas/RestRepoIssueConfig'
duplicateCode:
$ref: '#/components/schemas/RestRepoDuplicateCodeConfig'
testCoverage:
$ref: '#/components/schemas/RestRepoTestCoverageConfig'
statistics:
$ref: '#/components/schemas/RestRepoStatisticsConfig'
mergeChecks:
$ref: '#/components/schemas/RestRepoMergeCheckConfig'
provisioning:
$ref: '#/components/schemas/RestRepoProvisioningConfig'
RestRepoDuplicateCodeConfig:
type: object
properties:
showDuplicateCode:
type: boolean
description: Shows duplicate code lines found in the source view.
RestRepoIssueConfig:
type: object
properties:
showSonarIssues:
type: boolean
description: Show SonarQube™ issues in the pull request diff.
sonarIssueMinSeverity:
type: string
description: Only issues with severity equal or higher than this will be
shown.
enum:
- INFO
- MINOR
- MAJOR
- CRITICAL
- BLOCKER
RestRepoMergeCheckConfig:
type: object
properties:
mergeChecksForMatches:
type: string
example: ^(?!feature\/).*$
description: |
Only run merge checks for SOURCE branches of a pull request matching this regex (leave empty
to always run merge checks). Example for excluding feature branches: `^(?!feature\/).*$`
targetMergeChecksForMatches:
type: string
example: master|develop|release.*
description: |
Only run merge checks for TARGET branches of a pull request matching this regex (leave empty
to always run merge checks). This is useful when you e.g. only want to
run merge checks when you merge into `release/develop/master` branches but
do not want to run them when merging feature branches. Example for only
checking these branches: `master|develop|release.*`
qualityGatesEnabled:
type: boolean
description: This will use the configured quality gates for the SonarQube™
project as merge checks. If any of the quality gates has an error, merging
of pull requests will be prevented.
usersToIgnoreMergeCheck:
type: string
description: |
A list of Bitbucket Server users separated with `|!|` which
should be allowed to merge even if a quality gate fails. Example: `adam|!|sara`
groupsToIgnoreMergeCheck:
type: string
description: |
A list of Bitbucket Server groups separated with `|!|` which
members should be allowed to merge even if a quality gate fails. Example:
`devs|!|ops`
RestRepoProjectConfig:
type: object
properties:
sonarEnabled:
type: boolean
description: true if the app should be enabled for this repository
inheritFromProject:
type: boolean
description: true if you want to inherit the plug-ins settings for this
repository from the project; not supported for repository forks
buildType:
type: string
deprecated: true
description: Not used anymore.
enum:
- AUTO
- COMPATIBILITY
showIssuesInSource:
type: boolean
description: When enabled, SonarQube™ issues, coverage and duplicate lines will
be shown in the Bitbucket source file view as well.
illegalBranchCharReplacement:
type: string
deprecated: true
description: 'UNUSED: use illegalBranchCharReplacement setting on SonarQube™ server configuration '
branchPrefix:
type: string
description: Only necessary if you have SonarQube™ project keys where the branch
name differs from the one in Bitbucket. If you have a branch key like
`origin/branch` in your SonarQube™ project key, you therefore might want to
set this field to `origin/`.
pullRequestBranch:
type: string
description: Only necessary if you want to use the special pull request branches `refs/pull-requests/*/from`
instead of the source branch of the pull request to get data from SonarQube™.
This might be useful if you only build & analyze pull request branches,
but not the source branch of the pull request. Use values like `refs/pull-requests/%d/from`
or `pull-requests/%d` and the app will replace "%d" with the actual pull
request ID. Note that you must not enable this if you want to use pull
request analysis of commercial SonarQube™ editions or SonarCloud™ .
projectCleanupEnabled:
type: boolean
default: false
description: Deletes a SonarQube™ project when its corresponding branch is deleted
in Bitbucket (avoids to clutter up SonarQube™ when a lot of SonarQube™ projects
are created due to code reviews with branches).
forkCleanupEnabled:
type: boolean
default: false
description: |
Deletesa SonarQube™ project for a deleted branch in a repository fork (CAUTION: such
a project might be referenced from the origin repository and other forks,
therefore make sure that you really want this).
matchingBranchesRegex:
type: string
description: |
The app will only be enabled for pull requests with source branches matching this regular
expression. Example for only analyzing feature branches: `feature/.*` You
can also use negative patterns like `((?!feature/).)*` to enable it for
everything except feature branches.
RestRepoProvisioningConfig:
type: object
properties:
qualityProfileProvisioningEnabled:
type: boolean
description: SonarQube™ quality profiles are not shared between main and
feature branch projects. If this setting is enabled, this plug-in will
copy all quality profiles from the master to a branch project.
propertiesProvisioningEnabled:
type: boolean
description: SonarQube™ project properties (like file exclusion patterns)
that are configured in the main branch project are not applied to a new
branch project automatically. If this setting is enabled, this plug-in
will copy all project properties from the master to the branch project.
qualityGateProvisioningEnabled:
type: boolean
description: Copies the assigned quality gate from the main branch project
to new branch projects automatically.
RestRepoStatisticsConfig:
type: object
properties:
showBranchStatistics:
type: boolean
description: Shows SonarQube™ branch statistics in the repository source view.
showQualityGatesInLists:
type: boolean
description: Show quality gate status in the pull request and branches lists.
RestRepoTestCoverageConfig:
type: object
properties:
showCoverage:
type: boolean
description: Marks uncovered code lines in the source and pull request diff
view.
RestSonarProject:
type: object
required:
- moduleDir
- sonarAnalysisDir
- sonarProjectKey
- sonarProjectKeyPrefix
- sonarServerConfigId
properties:
id:
type: integer
format: int32
description:
ID of the SonarQube™ project mapping. Only necessary when updating/deleting a configuration.
sonarServerConfigId:
type: integer
format: int32
description:
Choose the SonarQube™ server to be used for this repository. Use the SonarQube™
server configuration REST service to get this ID
sonarProjectKey:
type: string
description: |
Enter the SonarQube™ project key. [SonarQube™ Community Edition: use project key from the main project.
This is also the project from which properties and quality profiles are copied when branch project provisioning is active]
sonarProjectKeyPrefix:
type: string
description: |
Only for SonarQube™ Community Edition: This is the branch project prefix of your SonarQube™ project key.
The app will append the branch name to it (`<branch project prefix>:<sonar-branch>`, e.g. `org.apache.commons:commons-lang3:master`)
sonarAnalysisDir:
type: string
description:
Path to the SonarQube™ analysis directory, relative to repo root and without leading slash, e.g. component/frontend/src.
Must start with the module directory. Leave empty if the analysis is done in the repository root
moduleDir:
type: string
description:
Path from the repository root to a submodule without leading slash, e.g. component/frontend.
Leave empty for a single SonarQube™ project
sonarProjectDesc:
type: string
readOnly: true
description:
SonarQube™ project description. Readonly, only for app usage.
RestSonarProjectsResponse:
type: array
items:
type: object
properties:
sonarServerConfigs:
$ref: "#/components/schemas/RestAdminConfig"
RestSonarProjectResponse: