Skip to content

feat: add SonarQube integration to entity pages#662

Open
kavix wants to merge 2 commits into
openchoreo:mainfrom
kavix:feat/sonarqube-entity-integration
Open

feat: add SonarQube integration to entity pages#662
kavix wants to merge 2 commits into
openchoreo:mainfrom
kavix:feat/sonarqube-entity-integration

Conversation

@kavix

@kavix kavix commented Jul 1, 2026

Copy link
Copy Markdown

Purpose

Resolves openchoreo/openchoreo#3935

Currently, developers have to leave the developer portal to check their code quality metrics on SonarQube. This PR integrates the @backstage-community/plugin-sonarqube ecosystem to bring those metrics directly into the entity pages.

Goals

Add a dedicated Code Quality tab to the Backstage entity pages that conditionally renders SonarQube metrics when the sonarqube.org/project-key annotation is present.

Approach

  • Backend Integration: Registered the @backstage-community/plugin-sonarqube-backend plugin in packages/backend/src/index.ts to proxy API requests safely to SonarQube.
  • Frontend Integration:
    • Installed @backstage-community/plugin-sonarqube and @backstage-community/plugin-sonarqube-react in packages/app.
    • Added the <EntitySonarQubeContentPage /> to ServiceEntityPage and GenericComponentEntityPage inside packages/app/src/components/catalog/EntityPage.tsx.
    • Conditionally gated the tab rendering using the isSonarQubeAvailable predicate.
  • Configuration: Documented the required sonarqube config block (expecting baseUrl and apiKey) in app-config.yaml.

User stories

As a developer, I want to see my component's SonarQube code quality metrics directly on its Backstage entity page, so that I can easily track technical debt, bugs, and coverage without context-switching.

Release note

Add SonarQube integration to display code quality metrics on Backstage entity pages.

Documentation

N/A - Standard Backstage community plugin integration. The required sonarqube configuration block has been documented in app-config.yaml as part of this PR.

Training

N/A

Certification

N/A - No impact on certification exams.

Marketing

N/A

Automation tests

  • Unit tests

    Validated component rendering using existing standard yarn test passes for the app package.

  • Integration tests

    N/A

Security checks

Samples

N/A

Related PRs

N/A

Migrations (if applicable)

N/A

Test environment

  • Node environment
  • Tested locally on MacOS against a standard Chrome browser.

Learning

Leveraged the Backstage community patterns for conditional entity page rendering using the plugin's built-in isSonarQubeAvailable hook to ensure the Code Quality tab only appears for annotated entities (matching the pattern used by the Jenkins and GitLab integrations).

Integrate @backstage-community/plugin-sonarqube to display code quality
metrics on Backstage entity pages.

- Register @backstage-community/plugin-sonarqube-backend in packages/backend/src/index.ts
- Add @backstage-community/plugin-sonarqube and plugin-sonarqube-react to packages/app
- Add EntitySonarQubeContentPage in a conditional tab (visible only when
  the sonarqube.org/project-key annotation is present) to ServiceEntityPage
  and GenericComponentEntityPage in EntityPage.tsx
- Document the sonarqube config block (baseUrl + apiKey) in app-config.yaml

Closes openchoreo/openchoreo#3935

Signed-off-by: kavix <kavix@yahoo.com>
@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@kavix, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 57 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 46be2a49-5e24-47d6-b3af-82982097aa63

📥 Commits

Reviewing files that changed from the base of the PR and between 71f7b6c and 7d232a3.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (8)
  • .changeset/sonarqube-entity-integration.md
  • app-config.yaml
  • packages/app/package.json
  • packages/app/src/components/catalog/EntityPage.tsx
  • packages/backend/package.json
  • packages/backend/src/index.ts
  • plugins/openchoreo-observability/src/components/RuntimeLogs/LogsTable.test.tsx
  • plugins/openchoreo/src/components/Environments/components/ReleaseBrowserDialog.tsx
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jul 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@LakshanSS LakshanSS left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kavix Thanks for the PR! Looks like the Prettier formatting check failed.

Signed-off-by: kavix <kavix@yahoo.com>
@kavix
kavix force-pushed the feat/sonarqube-entity-integration branch from 3878d19 to 7d232a3 Compare July 1, 2026 04:33
@kavix

kavix commented Jul 1, 2026

Copy link
Copy Markdown
Author

@kavix Thanks for the PR! Looks like the Prettier formatting check failed.

Thanks! I've run Prettier locally to fix the formatting issues, amended the commit with the required DCO sign-off, and updated the PR. Everything should be passing now!

@kavix
kavix requested a review from LakshanSS July 1, 2026 04:35
@stefinie123

stefinie123 commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

@kavix Please attach a screenshot of Portal UI how it looks like with the SonarQube plugin

Also take a pull from the main branch, there are conflicts in the yarn.lock file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add SonarQube integration to entity pages

3 participants