Configuring Sonarqube
in pre-build or post build task enhances your workflow with Continuous Code Quality & Code Security.
Prerequisite: Make sure you have set up an account in Sonarqube
or get the API keys from an admin.
On the Edit build pipeline page, select the Pre-Build Stage (or Post-Build Stage).
Click + Add task.
Select Sonarqube from PRESET PLUGINS.
Enter a relevant name in the Task name
field. It is a mandatory field.
Enter a descriptive message for the task in the Description
field. It is an optional field.
Provide a value for the input variable. Note: The value may be any of the values from the previous build stages, a global variable, or a custom value.
Trigger/Skip Condition
refers to a conditional statement to execute or skip the task. You can select either:
Set trigger conditions
or
Set skip conditions
Click Update Pipeline.
Variable | Format | Description |
---|---|---|
SonarqubeProjectKey
String
Project key of SonarQube account
SonarqubeApiKey
String
API key of SonarQube account
SonarqubeEndpoint
String
API endpoint of SonarQube account
CheckoutPath
String
Checkout path of Git material
UsePropertiesFileFromProject
Boolean
Enter either true
or false
accordingly whether the configuration file should be fetched from the project's source code
CheckForSonarAnalysisReport
Boolean
Enter either true
or false
accordingly whether you want poll or actively check for the generation of the SonarQube analysis report
AbortPipelineOnPolicyCheckFailed
Boolean
Enter either true
or false
accordingly whether you want to check if the policy fails or not