Skip to content

SonarQube plugin support #90

@ewega

Description

@ewega

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

  • gh devlake configure connection add --plugin sonarqube --endpoint https://sonar.example.com creates a SonarQube connection
  • SonarQube appears in interactive plugin picker
  • SonarQube scopes list projects for selection
  • Connection test works
  • go build ./..., go test ./..., go vet ./... pass

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions