Skip to main content

SonarQube

Connects to a SonarQube or SonarCloud server's web API. An agent can list projects, retrieve code quality metrics, list issues, and check quality gate status.

Add to an agent node's tools array with _node_type: "tool-sonarqube". See Connector Reference — How connectors are used.

Authentication

FieldRequiredDescription
base_urlYesBase URL of the SonarQube/SonarCloud server (e.g. https://sonarcloud.io).
tokenNoUser or project token, sent as HTTP Basic auth (token: with empty password).
organizationNoSonarCloud organization key, appended as &organization=<organization> to applicable requests. Not used for self-hosted SonarQube.
{
"name": "sonarqube",
"_node_type": "tool-sonarqube",
"base_url": "https://sonarcloud.io",
"token": "{{ secret.SONARQUBE_TOKEN }}",
"organization": "my-org"
}

Tools

sonarqube_list_projects

List SonarQube/SonarCloud projects with their quality gate status.

Parameters

ParameterTypeRequiredDescription
pagenumberNoPage number (default 1)

Returns: A newline-separated list of <name> key=<key> lines (20 per page).

sonarqube_get_metrics

Get code quality metrics for a SonarQube project (bugs, vulnerabilities, coverage, duplications, etc.).

Parameters

ParameterTypeRequiredDescription
componentstringYesProject key e.g. my-project
metricsstringNoComma-separated metric keys e.g. bugs,vulnerabilities,code_smells,coverage (default: bugs,vulnerabilities,code_smells,coverage,duplicated_lines_density,ncloc,reliability_rating,security_rating,sqale_rating)

Returns: A two-column text table (Metric / Value) listing each requested metric and its value.

sonarqube_list_issues

List code issues (bugs, vulnerabilities, smells) in a SonarQube project.

Parameters

ParameterTypeRequiredDescription
componentstringYesProject key
typesstringNoBUG, VULNERABILITY, CODE_SMELL, SECURITY_HOTSPOT (comma-separated)
severitystringNoBLOCKER, CRITICAL, MAJOR, MINOR, INFO
pagenumberNoPage number (only sent if greater than 1)

Returns: A first line Total issues: <N>, followed by one line per issue: [<type>] <severity> <rule> <message> (20 per page).

sonarqube_quality_gate

Check whether a project passes or fails its quality gate.

Parameters

ParameterTypeRequiredDescription
projectstringYesProject key

Returns: A first line Quality Gate: <status>, followed by one FAILED: <metric> (actual=<value> threshold=<threshold>) line for each failing condition.

Next