We are currently using SonarQube 9.9 LTS and we have ~1000 portfolios. Among them ~200 are portfolios with empty projects. We want to address this via an automation.
Is there any way to identify whether a portfolio is something with empty projects? Any APIs or database query available to get the data?
We have portfolios with projects associated to it and everyday portfolios are being recomputed. However, the main branch of many projects were not scanned / developers having different branches as their release branch and those branches were not selected in the portfolio. 200+ portfolios were just created and the branches were not mapped properly. Hence resulted portfolios with empty projects. We want to consolidate such portfolios to follow-up with corresponding app teams to ensure the mappings are available properly. Hence, we need an approach to identify such portfolios.
Found the solution - with the help of Sonar support team.
The following API call helped me to find the portfolios only with empty projects - api/measures/component?component=non_empty_portfolio&metricKeys=ncloc
The measures component will be an empty array if a portfolio only have empty projects.