Is there a way to get all of the Bitbucket projects and repositories that are using the app Include Quality for Bitbucket as checking manually is not possible via REST API or the Database?
Using REST API
You can check which repositories are using the app actively by iterating over all your repositories in Bitbucket with GET /rest/api/latest/repos: https://developer.atlassian.com/server/bitbucket/rest/v804/api-group-repository/#api-api-latest-repos-get
Calling the app’s REST endpoint for each repository by https://{YOUR_BITBUCKET_SERVER}/rest/sonar4stash/1.0/projects/{projectKey}/repos/{repositorySlug}/settings
and checking for the property sonarEnabled
in the response:
{ project": { "sonarEnabled": true, ... } }
Using Database
The table of the repo’s Sonar configuration is called AO_C716BC_REPO_CONFIG001
.
Query for the entries where Sonar is enabled:
select * from AO_C716BC_REPO_CONFIG001 where SONAR_ENABLED = TRUE
To get the repository with enabled Sonar configuration:
select PROJ.PROJECT_KEY, REPO.SLUG, * from AO_C716BC_REPO_CONFIG001 as SONAR join REPOSITORY as REPO on REPO.ID = SONAR.REPO_ID join PROJECT as PROJ on PROJ.ID = REPO.PROJECT_ID where SONAR_ENABLED = TRUE