Table of Contents | ||||
---|---|---|---|---|
|
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?
...
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:
Code Block |
---|
{ project": { "sonarEnabled": true, ... } } |
Using Database
The tables of our app start with table of the repo’s Sonar configuration is called AO_C716BC_REPO_
. Here is the query with project key/name and repository name included.
...
CONFIG001
.
Query for the entries where Sonar is enabled:
Code Block |
---|
select * from AO_C716BC_REPO_CONFIG001
where SONAR_ENABLED = TRUE |
To get the repository with enabled Sonar configuration:
Code Block |
---|
select PROJ.PROJECT_KEY, PROJECT.NAME, REPO_ID, REPO.SLUG, REPOSITORY.NAME, SONAR_ENABLED FROM * from AO_C716BC_REPO_CONFIG001 as SONAR join REPOSITORY as REPO JOIN REPOSITORY on REPOSITORYREPO.ID = SONAR.REPO_ID join PROJECT as JOIN PROJECT PROJ on PROJECTPROJ.ID = REPO.PROJECT_ID |
...
where SONAR_ENABLED = TRUE |