Summary
Add SonarQube as a supported DevOps tool in the CLI. SonarQube is the most popular code quality platform (~40% adoption), providing code coverage, code smells, and quality gate data complementary to DORA metrics.
Upstream Plugin
sonarqube in incubator-devlake/backend/plugins/sonarqube/
| Property |
Value |
| Plugin slug |
sonarqube |
| Auth |
AccessToken (SonarQube token; DevLake backend handles base64 encoding internally) |
| Scope type |
Projects (ProjectKey string) |
| Scope ID field |
projectKey |
| Default endpoint |
User-provided SonarQube instance URL |
| Remote-scope API |
Yes |
| Connection test |
Yes |
| Extra field |
Optional organization |
Dependencies
Blocked by:
Not blocked by #85 — SonarQube uses AccessToken, compatible with current auth model.
Changes
- Add
ConnectionDef for sonarqube in connectionRegistry:
AuthMethod: "AccessToken" (or empty, defaults to AccessToken)
Endpoint: "" (user must provide)
SupportsTest: true
TokenPrompt: "SonarQube token"
EnvVarNames: []string{"SONARQUBE_TOKEN", "SONAR_TOKEN"}
EnvFileKeys: []string{"SONARQUBE_TOKEN", "SONAR_TOKEN"}
ScopeIDField: "projectKey"
ScopeFunc: scopeSonarQubeHandler
- Implement
scopeSonarQubeHandler:
- Use
client.ListRemoteScopes("sonarqube", connID, "", "") to list projects
- Let user select projects interactively or via
--projects flag
- PUT selected projects as scopes
- Set
Available: true
Acceptance Criteria
Summary
Add SonarQube as a supported DevOps tool in the CLI. SonarQube is the most popular code quality platform (~40% adoption), providing code coverage, code smells, and quality gate data complementary to DORA metrics.
Upstream Plugin
sonarqubeinincubator-devlake/backend/plugins/sonarqube/sonarqubeProjectKeystring)projectKeyDependencies
Blocked by:
projectKeyneedsScopeIDField)Not blocked by #85 — SonarQube uses AccessToken, compatible with current auth model.
Changes
ConnectionDefforsonarqubeinconnectionRegistry:AuthMethod: "AccessToken"(or empty, defaults to AccessToken)Endpoint: ""(user must provide)SupportsTest: trueTokenPrompt: "SonarQube token"EnvVarNames: []string{"SONARQUBE_TOKEN", "SONAR_TOKEN"}EnvFileKeys: []string{"SONARQUBE_TOKEN", "SONAR_TOKEN"}ScopeIDField: "projectKey"ScopeFunc: scopeSonarQubeHandlerscopeSonarQubeHandler:client.ListRemoteScopes("sonarqube", connID, "", "")to list projects--projectsflagAvailable: trueAcceptance Criteria
gh devlake configure connection add --plugin sonarqube --endpoint https://sonar.example.comcreates a SonarQube connectiongo build ./...,go test ./...,go vet ./...pass