SonarQube tasks for Azure Pipelines
This page describes the tasks supported by the Azure DevOps Extension for SonarQube Community Build you can use in your Azure build pipeline.
Prepare Analysis Configuration task
This task configures the required settings before executing the build. For .NET solutions or Java projects, it helps integrate seamlessly with MSBuild, Maven, and Gradle tasks.
Task inputs common to all modes
The table below lists the Prepare Analysis Configuration task inputs common to all modes of the Azure DevOps Extension for SonarQube Community Build.
Task input | Description | Required in YAML file |
---|---|---|
SonarQube | Name of the SonarQube service connection(s) (SonarQube Endpoint) to your Azure DevOps project. See Adding SonarQube Community Build service connection to Azure Pipelines in Setting up Azure DevOps integration at the project level. | x |
scannerMode | The running mode of the Azure DevOps Extension for SonarQube Community Build. Possible values:
| x |
Task inputs specific to the Maven / Gradle mode
The table below lists the Prepare Analysis Configuration task inputs specific to the Maven / Gradle mode of the Azure DevOps Extension for SonarQube Community Build.
Input | Description | Required in YAML file |
---|---|---|
extraProperties | Additional sonar properties to be passed to the scanner. A property is defined through a [key, value] pair. Format: One [key, value] pair per line as follows: | x (to set the project key) |
Task inputs specific to the .NET mode
The table below lists the Prepare Analysis Configuration task inputs specific to the .NET mode of the Azure DevOps Extension for SonarQube Community Build. The Corresponding sonar property column indicates the sonar property that SonarQube Community Build will set with the input value. See the sonar property description in Analysis parameters for more information on the possible values and default-from-build values.
Task input | Description | Corresponding sonar property | Required in YAML file |
---|---|---|---|
projectKey |
| sonar.projectKey | x |
projectName | The name of the SonarQube Community Build project that will be displayed on the web interface. Default: | sonar.projectName | |
projectVersion | The version of the SonarQube Community Build project. | sonar.projectVersion | |
dotnetScannerVersion | The version of the SonarScanner for .NET to be downloaded. See Using a specific SonarScanner version. Default: The extension’s default version of the SonarScanner for .NET (the latest compatible version). |
Task inputs specific to the CLI mode
The table below lists the Prepare Analysis Configuration task inputs specific to the CLI mode of the Azure DevOps Extension for SonarQube Community Build. The Corresponding sonar property column indicates the sonar property that SonarQube Community Build will set with the input value. See the sonar property description in Analysis parameters for more information on the possible values and default-from-build values.
Task input | Description | Corresponding sonar property | Required in YAML file |
---|---|---|---|
cliSources | The path to the root directory containing source files. The path can be absolute, or relative to the repository root. Warning: The possible values are different from the
Default: . | sonar.sources | x |
configMode | Specifies the configuration mode. Possible values:
| x | |
cliScannerVersion | Version of the SonarScanner CLI to be downloaded. See [link] Default: The extension’s default version of the SonarScanner CLI (the last available version). | ||
configFile | Is used if Default: sonar-project.properties | ||
cliProjectKey | Is used if
| sonar.projectKey | x |
cliProjectName | Is used if The name of the SonarQube Community Build project that will be displayed on the web interface. Default: | sonar.projectName | |
cliProjectVersion | Is used if configMode is set to manual .The version of the SonarQube Community Build project. | sonar.projectVersion | |
extraProperties | Is used if Additional sonar properties to be passed to the scanner. A property is defined through a [key, value] pair. Format: One [key, value] pair per line as follows: |
Run Code Analysis task
This task executes the analysis of the source code. It is not used in the Gradle / Maven mode of the Azure DevOps Extension for SonarQube Community Build.
The table below lists the task inputs.
Task input | Description |
---|---|
| The version of Java used by the scanner for analysis. See General requirements on scanner environment. If you select a value other than JAVA_HOME, the analyze task will revert to using JAVA_HOME if the selected environment variable does not exist. Possible values:
Default: |
Publish Quality Gate Result task
This task allows you to report the quality gate status directly to your Azure Pipeline's Build Summary page. It is not mandatory but highly recommended.
The Publish Quality Gate Result task can significantly increase the overall build time because it will poll SonarQube until the analysis is complete.
The table below lists the task inputs.
Task input | Description |
---|---|
pollingTimeoutSec | The maximum time (in seconds) for the task to wait for the analysis results sent by SonarQube Community Build. Default: 300 |
Related pages
- Azure Pipelines integration overview
- Adding analysis for a Gradle or Maven project
- Adding analysis for a .NET project
- Adding analysis for a JS, TS, GO, Python, PHP or other project
- Using various features when adding the analysis to your build pipeline
- Checking the SonarQube quality gate status in your Azure release pipeline
Was this page helpful?