Portfolios are available starting in Enterprise Edition.
There are two levels of users with permissions for adding and editing portfolios: users with the Create Portfolios permission and Global Administrators.
Create Portfolios permission
Users with the Create Portfolios permission (granted at the global level at Administration > Security > Global Permissions) can create portfolios by clicking the Create Portfolio button in the upper-right corner of the Portfolios homepage.
Users with the Create Portfolios permission can edit an individual portfolio definition from the portfolio-level Portfolio Settings > Edit Definition interface.
In addition to the access granted to users with the Create Portfolios permission, Global Administrators have access to the overall portfolio and application administration interface at Administration > Configuration > Portfolios. From this page, they can create and edit portfolios.
Global Administrators also have access to the Projects Management page at Administration > Projects > Management. Changing the selection mechanism on this page to Portfolios or Applications lets you manage the portfolios or applications of your SonarQube instance. The dropdown menu to the right of each item lets you edit permissions, apply permission templates or restore access to a portfolio or application.
Once your portfolio exists, you can populate it with any mix of projects, applications, and sub-portfolios.
Adding a sub-portfolio
To add a sub-portfolio, click on Add Portfolio at the top of the third column, and choose:
- Standard - This option allows you to create a new sub-portfolio from scratch. Once created, you can add projects, applications, and more layers of sub-portfolios.
- Local Reference - This option allows you to reference an existing portfolio/application as a sub-portfolio. Once added, it is not editable here, but must be chosen in the left-most column to be edited.
Adding projects to a portfolio
To add projects directly to a portfolio or standard sub-portfolio first make sure the correct item is selected, then choose the Project selection mode:
- Manual – choose the projects individually.
- Tags - select one or more project tags. Projects with those tags will automatically be included.
- Regular Expression – specify a regular expression and projects with a matching name OR key will be included.
- All Remaining Projects – choose this option to add all projects not already included in this portfolio (directly or via sub-portfolio).
Adding applications to a portfolio
To add an application to a portfolio, first make sure your application is already created. Then:
- Navigate to the portfolios configuration page by going to Administration > Configuration > Portfolios.
- Select the portfolio where you want to add your application
- Click Add Portfolio
- Select Local Reference
- Choose your application from the drop-down list and click Add.
Project uniqueness under a portfolio
Projects, applications and sub-portfolios can only appear once in any given hierarchy in order to avoid magnifying their impacts on aggregated ratings. The portfolio configuration interface has some logic to prevent obvious duplications (e.g. manually adding the same project), however in case of more subtle duplications (e.g. due to regex, or other bulk definition), then the calculation of that portfolio will fail with a helpful error message.
By default, portfolios are queued to be recalculated after each analysis of an included project. For each relevant portfolio, a background task is created, and you can follow the progress on each in the Administration > Projects > Background Tasks by looking at the logs available for each item.
If you're having performance issues related to automatic recalculation of large portfolios, you can specify the hour(s) at which you want them to be recalculated at Administration > Configuration > General Settings > Portfolios > Recalculation. Portfolios are queued to be recalculated at the beginning of the hour(s) that you specify.
During Elasticsearch reindexing due to disaster recovery or an upgrade, you won't have access to portfolios until all projects are indexed.
© 2008-2022, SonarSource S.A, Switzerland. Except where otherwise noted, content in this space is licensed under a Creative Commons Attribution-NonCommercial 3.0 United States License. SONARQUBE is a trademark of SonarSource SA. All other trademarks and copyrights are the property of their respective owners.