Chapter 25Lesson 01~140 minutes

Portfolios, Applications, Enterprise Reporting, and Governance Boundaries: Core Concepts and Mental Model

Treat applications, portfolios, and enterprise reports as derived governance views over independently verifiable project analyses, with explicit edition and aggregation semantics.

GovernanceApplicationsPortfoliosReportingAggregation

Learning objectives

  • Distinguish a SonarQube project, application, portfolio, PDF report, and free local governance simulation by purpose and edition.
  • Trace project analysis histories into derived governance views without treating the aggregate as a replacement for project evidence.
  • Explain current application recalculation, portfolio releasability, rating aggregation, permission, and freshness semantics.
  • Identify the exact branch, analysis date, Quality Gate state, rating model, and inclusion rule behind every executive signal.
  • Explain why percentages and ratings cannot be combined with one universal averaging formula.
  • Use Community Build project APIs as the mandatory evidence source while keeping commercial aggregation optional or simulated.

1. The practical problem: governance needs a wider view without losing the source of truth

Chapter 24 ended with several independently analyzed project boundaries inside one complex repository. That solves scanner ownership, but it creates a governance question: How does a release owner, engineering director, security lead, or executive understand the health of many projects without manually opening every dashboard?

SonarQube Server answers that question with commercial aggregation constructs. An Application groups projects that share a lifecycle and should be understood as one releasable product. A Portfolio groups projects, applications, or nested portfolios for a higher-level governance view. Enterprise PDF reports package selected high-level state for periodic consumption. None of those constructs replaces the underlying project analyses.

project revision + analysis parameters → scanner upload → Compute Engine result → project measures / Quality Gate / analysis date → governed grouping definition → derived application or portfolio state → executive/technical report → drill-down action

2. Mental model: aggregation is derived state

A project analysis owns the code evidence. The scanner knows the revision, source scope, test/coverage inputs, analyzer configuration, and project key. The server processes that report asynchronously and stores the project measures and Quality Gate result. Only after those facts exist can a governance object derive a wider view.

Governance derivation
flowchart TD
  A[Project A analysis history] --> G[Governed grouping]
  B[Project B analysis history] --> G
  C[Project C analysis history] --> G
  G --> D{Lifecycle goal}
  D -->|ships together| E[Application - Developer+]
  D -->|executive oversight| F[Portfolio - Enterprise+]
  E --> H[Application measures / gate]
  F --> I[Portfolio releasability / ratings / trends]
  H --> J[Report + drill-down]
  I --> J
  J --> K[Owner action on underlying project evidence]

The key governance invariant is that an aggregate is never more current or more authoritative than its newest valid component evidence. Preserve each project's scanner report identity, ceTaskId, terminal Compute Engine result, and analysis date before trusting the aggregate. If one project has not been analyzed for three weeks, the aggregate may still render beautifully while containing stale state.

3. Current edition boundary

Object/capability Current minimum edition What it represents Mandatory free fallback
Project Community Build Primary analysis history, issues, measures, Quality Gate, source scope. Use real Community Build projects.
Application Developer Edition A synthetic project-like view over projects that share one lifecycle/release. Maintain an explicit application membership manifest and report component evidence separately.
Portfolio Enterprise Edition Executive governance view over selected projects/applications/portfolios. Generate a labeled local governance report from project APIs.
PDF reports Enterprise Edition+ Periodic high-level reports for projects, applications, and portfolios. Generate Markdown/HTML locally with timestamps and drill-down URLs.
Data Center Data Center Edition High availability/scalability deployment, not a different aggregation formula. Not required for this chapter.
Do not collapse licensing into architecture. A Community Build script can calculate a useful external summary, but it does not create a SonarQube Application, Portfolio, native portfolio history, portfolio permissions, or Enterprise PDF report.

4. Application: lifecycle aggregation

Use an Application when technically separate SonarQube projects are deployed as one product. Current Sonar documentation describes an application as a synthetic project with a unified overview, issue list, measures, and consolidated Quality Gate. Applications are recalculated after relevant member-project analyses, and those recalculations are asynchronous background tasks.

This creates two timestamps worth preserving: each component project’s latest analysis time and the application’s own most recent recalculation. A project can have fresh evidence while an application view is still waiting in a background-task queue.

Do not infer application state by simply OR-ing project gates. The native Application is its own derived SonarQube object with aggregated measures and its own Quality Gate calculation. The free lab therefore labels its lifecycle summary as a simulation instead of claiming exact native application computation.

5. Portfolio: executive oversight and explicit aggregation rules

A Portfolio is designed for broader oversight, often across projects that do not ship together. Current portfolio reporting exposes releasability, ratings, trends, project counts, lines of code, and last-analysis context. This makes it useful for management—but only if its aggregation semantics are understood.

Releasability

Current SonarQube portfolio releasability is derived from the proportion of included project branches whose Quality Gates pass. The letter bands are:

  • A: more than 80% pass.
  • B: more than 60% through 80%.
  • C: more than 40% through 60%.
  • D: more than 20% through 40%.
  • E: 20% or less.
An A portfolio can still contain failures. Nine passing branches out of ten is 90%, therefore A, while one project is still failing its Quality Gate. Executive status must retain drill-down.

Portfolio quality ratings

For portfolio Reliability, Security, Security Review, and Maintainability ratings, current documentation converts each project letter to a number (A=1 through E=5), averages the numeric values, rounds a .5 upward toward the worse rating, and converts back to a letter. This is a specific Sonar portfolio rule—not a general instruction to average every metric.

6. Percentages need their own denominator

Coverage demonstrates why a universal average is unsafe. Project A at 90% over 1,000 executable/condition opportunities and Project B at 50% over 20 opportunities should not be reported as 70% simply because (90+50)/2=70. The correct aggregate must be rebuilt from the underlying numerator and denominator.

Sonar’s overall coverage definition is:

coverage = (covered conditions + covered lines) / (conditions to cover + lines to cover)

For an external governance report, either use a documented Sonar aggregate object or recompute only when you possess the underlying counts and can state the exact formula. Otherwise show project percentages side-by-side and explicitly decline to invent a total.

7. Report timestamp is not analysis timestamp

Timestamp Owner Question answered
Git commit time/SHA SCM Which revision does the source represent?
Scanner / CE task Scanner + SonarQube server Was that report processed successfully?
Project analysis date SonarQube project How fresh is this project evidence?
Application/portfolio recomputation Commercial aggregate object When was derived state recalculated?
PDF/Markdown generation time Reporting system When was this document rendered?

A report generated today can contain a project whose last analysis occurred months ago. Report generation time must never be presented as proof of evidence freshness.

8. Permissions and confidentiality survive aggregation

Applications and portfolios have their own administration/view permissions, but component projects may also be private. A governance export must not become a data-exfiltration shortcut. Preserve the identity that generated the report, the objects it could browse, and any intentionally omitted/restricted components.

Enterprise PDF distribution deserves special caution because reports can be emailed or downloaded. Treat report recipients as a data-access decision, not merely a presentation preference.

9. Read-only inspection before creating any aggregate

export SONAR_HOST_URL="http://localhost:9000"
# SONAR_REPORT_TOKEN is a disposable user token with Browse only on lab projects.

curl -fsS -H "Authorization: Bearer $SONAR_REPORT_TOKEN" \
  "$SONAR_HOST_URL/api/projects/search?ps=100" > evidence/projects.json

curl -fsS -H "Authorization: Bearer $SONAR_REPORT_TOKEN" \
  "$SONAR_HOST_URL/api/measures/component?component=sq-ch25-payments&metricKeys=alert_status,ncloc,coverage,line_coverage" \
  > evidence/payments-measures.json

curl -fsS -H "Authorization: Bearer $SONAR_REPORT_TOKEN" \
  "$SONAR_HOST_URL/api/project_analyses/search?project=sq-ch25-payments&ps=1" \
  > evidence/payments-analyses.json

Before any native Application/Portfolio creation on a licensed instance, additionally record the proposed member keys/branches, owning team, intended audience, create/admin permissions, selection mode, and rollback plan.

Knowledge check

What is the primary source of truth: a project analysis or a portfolio report?

Can an A releasability portfolio contain a failed Quality Gate?

Why is averaging project coverage percentages usually wrong?

Which edition first provides Applications? Which first provides Portfolios?

A PDF was generated today. What extra timestamp must an auditor still inspect?

Next lesson

Build the governance view from real project evidence

Lesson 2 creates three real Community Build projects and a labeled free governance report with transparent aggregation rules.

Official references and version notes

  • SonarQube downloads and editions — current Community Build, commercial release stream, Developer/Enterprise/Data Center feature boundaries, and current LTA.
  • SonarQube Server — Applications — lifecycle-oriented synthetic aggregation, consolidated application view/gate, and recalculation model.
  • Managing applications — creation/admin permissions, project/branch membership, and background recalculation.
  • SonarQube Server — Portfolios — Enterprise boundary, releasability, rating conversion/averaging, breakdown, trend, and last-analysis context.
  • Managing portfolios — permissions, project/branch selection, applications/nested portfolios, and recalculation.
  • PDF reports — Enterprise Edition+ reports for projects/applications/portfolios, subscriptions, and permanent-branch constraints.
  • Measures and metrics — coverage numerator/denominator, ratings, Quality Gate metrics, and portfolio-visible metric boundaries.
  • Community Build Web API — bearer authentication and documented project evidence retrieval used by the free lab.
Version and compatibility note

Rechecked 2026-09-08. Mandatory examples target Community Build 26.9.0.129388 and SonarScanner CLI 8.1.0.6389. The current commercial intermediate line is SonarQube Server 2026 Release 4.1 / 2026.4.1; the current LTA is 2026.1.5 LTA. Applications start in Developer Edition. Portfolios and native PDF reporting start in Enterprise Edition. Current portfolio releasability is a Quality-Gate pass ratio with A/B/C/D/E thresholds; portfolio quality ratings use documented A=1 through E=5 conversion and averaging. Do not extrapolate those formulas to coverage, duplication, SCA, or other percentages/counts without metric-specific documentation. Aggregate objects and reports can lag component analysis because recalculation/reporting are separate state transitions; always record member branches, analysis dates, object definition, permissions, report timestamp, and mode (MQR or Standard Experience).

Governance boundary. This chapter never asks learners to bypass licensing, copy commercial binaries, expose restricted project data, lower Quality Gates, delete failing members, or edit SonarQube database/search state. Community Build exercises use project-level evidence and a clearly labeled external simulation. Any licensed Application/Portfolio/PDF exercise belongs only on an authorized disposable Server instance.

Keep the academy open

Support free, practical DevOps education.

Every lesson is designed to remain readable in a browser, downloadable from GitHub, and usable without a paid learning platform. Contributions help expand and maintain the curriculum.

Ethereum / ERC-20
0x716c4Ab160C4B66F31a28AE2448BfF68fc3a2ef0Send only Ethereum/ERC-20 compatible assets to this address.