Skip to content

CI: Add SonarCloud integration for abbenay - #106

Merged
Hrithik-Gavankar merged 6 commits into
mainfrom
feat/sonar-cloud-integration
Aug 11, 2026
Merged

CI: Add SonarCloud integration for abbenay#106
Hrithik-Gavankar merged 6 commits into
mainfrom
feat/sonar-cloud-integration

Conversation

@Hrithik-Gavankar

@Hrithik-Gavankar Hrithik-Gavankar commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add sonar-project.properties for SonarCloud analysis of the TypeScript monorepo (packages/daemon, packages/vscode).
  • Update CI to generate daemon coverage (lcov.info), upload it as a SonarCloud artifact, and store PR metadata for branch analysis.
  • Add a finalize workflow that runs after CI and uploads results to SonarCloud (same pattern as other Ansible DevTools repos, e.g. vscode-ansible).

SonarCloud project details

  • Organization: redhat-developer
  • Project key: redhat-developer_abbenay
  • Coverage: packages/daemon/coverage/lcov.info

Blockers / follow-up

SonarCloud access for the redhat-developer org is required before this can fully work. A separate ticket has been raised to:

  • Create/import the redhat-developer/abbenay project in SonarCloud
  • Grant DevTools team access
  • Configure the CI token in GitHub Actions secrets

Until that is done, the finalize workflow is expected to fail.

Test plan

  • CI passes (lint-and-test, build, package-python)
  • Daemon coverage artifact (sonar-coverage) is uploaded
  • After SonarCloud access is granted, finalize workflow completes successfully
  • SonarCloud shows analysis results on the PR

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • Chores
    • Enhanced automated testing to support coverage checks in graphical environments.
    • Added reliable coverage report handling and short-term retention for quality analysis.
    • Added automated code quality scanning after successful builds for pull requests and main-branch updates.
    • Improved coverage validation and reporting configuration for more accurate quality insights.

Walkthrough

CI now runs daemon coverage tests with xvfb and uploads the LCOV report. A finalize workflow consumes the artifact, resolves pull-request metadata, validates coverage, and runs a pinned SonarQube scan using the new project configuration.

Changes

SonarCloud analysis

Layer / File(s) Summary
Coverage artifact production
.github/workflows/ci.yml
CI runs the daemon coverage test with xvfb. It uploads the LCOV report when the report exists.
Finalize workflow input preparation
.github/workflows/finalize.yml
The finalize workflow runs after successful CI events, checks out full history, downloads the coverage artifact, and resolves pull-request metadata.
SonarQube scan configuration and execution
.github/workflows/finalize.yml, sonar-project.properties
The workflow builds SonarCloud arguments, validates coverage availability, and runs the pinned scan action. The project file defines source paths, test paths, LCOV reports, exclusions, and analysis settings.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CI
  participant GitHub_Actions
  participant finalize
  participant GitHub_CLI
  participant SonarQube_scan
  CI->>CI: Run daemon coverage test with xvfb
  CI->>GitHub_Actions: Upload LCOV artifact
  finalize->>GitHub_Actions: Download coverage artifact
  finalize->>GitHub_CLI: Retrieve pull-request metadata
  GitHub_CLI-->>finalize: Return base and head branches
  finalize->>SonarQube_scan: Run configured analysis
Loading

Suggested reviewers: cidrblock

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely identifies the SonarCloud integration added to CI for abbenay.
Description check ✅ Passed The description accurately covers the SonarCloud configuration, coverage workflow, prerequisites, and test plan.

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.

@Hrithik-Gavankar
Hrithik-Gavankar marked this pull request as ready for review August 10, 2026 19:03

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/ci.yml:
- Around line 65-66: Update the existing daemon coverage step to run through
xvfb-run, then remove the duplicate “Test daemon with coverage” step so daemon
coverage executes only once and preserves the existing coverage output.

In @.github/workflows/finalize.yml:
- Around line 44-64: The workflow_run job must stop trusting executable PR
artifact content for control flow. In .github/workflows/finalize.yml lines
44-64, derive the PR number from the trusted workflow_run.pull_requests payload
or a GitHub API lookup associated with the run, validate it contains only
digits, pass it through env, and reference it as "$PR_NUMBER" in shell commands;
in .github/workflows/ci.yml lines 76-85, remove the PR-number artifact
upload/channel entirely.
- Around line 21-25: Update the Checkout repository step in
.github/workflows/finalize.yml lines 21-25 to set ref to
github.event.workflow_run.head_sha, ensuring scans use the exact CI revision.
Remove the gh pr checkout step at .github/workflows/finalize.yml lines 61-64,
which can replace that revision; both affected sites must be updated so coverage
and sonar.scm.revision use the same source.

In `@sonar-project.properties`:
- Around line 14-17: Update the SonarQube configuration so sonar.sources and
sonar.tests do not share the packages/daemon/src or packages/vscode/src roots;
retain only dedicated test paths in sonar.tests or exclude test files from
sonar.sources, ensuring each .test.ts file is classified exclusively as test
code.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 89cac35f-b605-4425-a1dc-e580088c4dac

📥 Commits

Reviewing files that changed from the base of the PR and between 9d26eb2 and 61c01b4.

📒 Files selected for processing (3)
  • .github/workflows/ci.yml
  • .github/workflows/finalize.yml
  • sonar-project.properties

Comment thread .github/workflows/ci.yml Outdated
Comment thread .github/workflows/finalize.yml
Comment thread .github/workflows/finalize.yml Outdated
Comment thread sonar-project.properties

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/finalize.yml:
- Around line 21-27: Update the SONAR_ARGS definition in the finalize workflow
to include the command-line property sonar.host.url=https://sonarcloud.io,
ensuring the scanner always targets SonarCloud regardless of pull-request
changes to sonar-project.properties.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7c6f56fb-21e7-4673-9177-3c80aff31033

📥 Commits

Reviewing files that changed from the base of the PR and between 61c01b4 and 0758e2a.

📒 Files selected for processing (3)
  • .github/workflows/ci.yml
  • .github/workflows/finalize.yml
  • sonar-project.properties
🚧 Files skipped from review as they are similar to previous changes (1)
  • sonar-project.properties

Comment thread .github/workflows/finalize.yml

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/finalize.yml:
- Line 121: Update the SONAR_TOKEN environment variable in the workflow to
reference secrets.CICD_ORG_SONAR_TOKEN_CICD_BOT instead of secrets.SONAR_TOKEN,
preserving the existing SonarCloud configuration.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2b09ba18-2a7a-4aa2-8827-92d6b80ef111

📥 Commits

Reviewing files that changed from the base of the PR and between 0758e2a and 13f4d3b.

📒 Files selected for processing (1)
  • .github/workflows/finalize.yml

Comment thread .github/workflows/finalize.yml
@Hrithik-Gavankar
Hrithik-Gavankar merged commit 201b446 into main Aug 11, 2026
9 checks passed
@sudhirverma
sudhirverma deleted the feat/sonar-cloud-integration branch August 11, 2026 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants