Skip to content

Configure SonarQube analysis in CI - #9

Draft
trly wants to merge 1 commit into
mainfrom
sonarqube-analysis-config-e4130c36-a1ca-4c80-b9be-4ebebc4b7547
Draft

Configure SonarQube analysis in CI#9
trly wants to merge 1 commit into
mainfrom
sonarqube-analysis-config-e4130c36-a1ca-4c80-b9be-4ebebc4b7547

Conversation

@trly

@trly trly commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Configures SonarQube static analysis for this project, based on the setup in deprecated-java-api-demo-1.

Gradle projects get the org.sonarqube plugin and a sonar configuration block; Maven projects get the sonar-maven-plugin and Sonar properties in pom.xml plus a dedicated analysis workflow on JDK 17. Both record the project name and the repository's SCM URL. Repositories that already had part of this setup only receive the difference.

Before analysis will run, set a SONAR_PROJECT_KEY repository variable (Settings → Secrets and variables → Actions → Variables) to the key SonarQube assigned this project when it was imported through the GitHub App — for example sourcegraph-testing_<repo>_<uuid>, visible in the project's URL as ?id=<key>. The key is not hardcoded because the generated suffix cannot be derived from the repository name, and it is not left to default because the scanner would otherwise invent a key from the Gradle project name and create a second, unbound project. The analysis step is skipped while the variable is unset.

Analysis runs as its own step marked continue-on-error, so an unsuccessful scan never fails the build. It also needs the SONAR_TOKEN secret and, for self-hosted SonarQube, a SONAR_HOST_URL secret including the https:// scheme.

Created by Sourcegraph agentic batch change.

@trly
trly force-pushed the sonarqube-analysis-config-e4130c36-a1ca-4c80-b9be-4ebebc4b7547 branch from 159bb95 to b057abc Compare August 7, 2026 19:30
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.

1 participant