Skip to content

Configure SonarQube analysis in CI - #9

Closed
trly wants to merge 1 commit into
mainfrom
sonarqube-key-lookup-e4130c36-a1ca-4c80-b9be-4ebebc4b7547
Closed

Configure SonarQube analysis in CI#9
trly wants to merge 1 commit into
mainfrom
sonarqube-key-lookup-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 project properties in pom.xml plus a dedicated analysis workflow on JDK 17. Repositories that already had part of this setup only receive the difference.

Projects imported through the SonarQube GitHub App are assigned a generated project key of the form <org>_<repo>_<uuid>, which cannot be derived from GitHub context. A shared helper, .github/scripts/resolve-sonar-project-key.sh, therefore looks the key up through the SonarQube API at analysis time and passes it to the scanner. If no bound project is found the scan is skipped rather than allowed to auto-create a second, unbound project.

Analysis runs as its own step marked continue-on-error, so an unsuccessful or unconfigured scan never fails the build. Analysis requires the SONAR_HOST_URL (including the https:// scheme) and SONAR_TOKEN secrets; without them the step logs the reason and exits cleanly.

Created by Sourcegraph agentic batch change.

@trly trly closed this Aug 7, 2026
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