SonarQube Integration
Send your SonarQube Quality Gate analysis to OpsLevel.
Add a SonarQube Integration
- In the OpsLevel app, Click Integrations in the left sidebar.
- Click on the + New Integration button.
- Click the SonarQube tile to add the integration.
Create a Check
1. Navigate to the Rubrics sub menu under the Service Maturity menu in OpsLevel.
2. Hover over the cell that corresponds to the level and category you want your check to live in and click the + Add Check button.
3. Create a SonarQube check.
4. Choose one of the Check Templates from the dropdown.
Here is what each template is for:
- Check for passing Security Check: Any service whose quality gate status for
new_security_rating
metric isERROR
will fail this check. - Check for passing Reliability Check: Any service whose quality gate status for
new_reliability_rating
metric isERROR
will fail this check. - Check for passing Maintainability Check: Any service whose quality gate status for
new_maintainability_rating
metric isERROR
will fail this check. - Check for passing Code Coverage Check: Any service whose quality gate status for new / updated source code is
ERROR
will fail this check.
6. We will populate the Service Specifier field, which we use to determine what service to run the check for, and the Success Condition field, which we use to determine if the check should pass or fail. We also provide a sample payload to test the check.
Send payload to OpsLevel
-
Add a new webhook for your project in SonarQube using the Webhook URL after you create the integration in the previous step
-
Ensure your SonarQube
projectKey
is configured as an alias for your desired OpsLevel service. -
Start a sonarscan to begin delivering Quality Gate information to OpsLevel. The easiest way to run a scan on demand is to use SonarQube’s docker container setup (don’t forget to set your
sonar.projectKey
insonar-project.properties
first):docker run
--rm
-e SONAR_HOST_URL="http://${SONARQUBE_URL}"
-e SONAR_LOGIN="myAuthenticationToken"
-v "${YOUR_REPO}:/usr/src"
sonarsource/sonar-scanner-cli
You can copy the SONARQUBE_URL
from the SonarQube Integration page in OpsLevel.
To learn more about SonarQube, check out their getting started guide.
Updated over 1 year ago