Hi,
we have configured new code conditions on the sonarqube, but it will show all new code bugs particular time period, we don’t need it, we need to show the latest commit bugs /to show the sonarqube db,
Hi,
we have configured new code conditions on the sonarqube, but it will show all new code bugs particular time period, we don’t need it, we need to show the latest commit bugs /to show the sonarqube db,
For example, when the jenkins trigger a new build, that builds bugs that are only displayed on the sonarqube new code, it will not show the yesterday build bugs particular build bugs need to show the soanrqube dashboard
Hello @swarup,
Sorry but
Olivier
Hi,
We are planning to if any new bug rise on the sonarqube dashboard, jenkins build get to fail,
Hello @swarup ,
I understand now.
As I told you before, even if what you want is possible with a convoluted configuration, it’s not a good practice, nor it is a good practice to have a new code period of 1 day. In your example the 121 bugs of today will become 0 tomorrow (meaning that nobody will care to fix them).
My recommendation if you want to get the list of issues between 2 builds is to use the API to extract the new issues, and look at the precise issue timestamp (creation date) to filter those for which you want to do something special.
The API to use is api/issues/search
. Something like the below should help you:
curl -X GET -u <SQuserToken>: "https:<SonarQubeURL>/api/issues/search?componentKeys=<yourProjectKey>&createdAfter=YYYY-MM-DD"
See the documentation of api/issues/search
for details, there are plenty of more precise options there.
Olivier
Hi,
Thank you for providing the information
We are using Sonarqube 8.9 community version. we are trying to pull request build should fail any new bug rise on the.Sonarqube, once we created bitbucket pullrequest jenkins automatically trigger the build and if any bug rise quality showing red build trigger the failed, we have configured using below script.
#!/bin/bash
sleep 1m
echo “Checking status of SonarQube Project = test-demo11”
sonar_status= `curl -s -u sonartoken: https://sonarqube.com/api/qualitygates/project_status?projectKey=test-demo11 | grep '{' | python -c 'import json,sys;obj=json.load(sys.stdin);print obj["'projectStatus'"]["'status'"];'`
echo “SonarQube status = $sonar_status”
if [ “$sonar_status” = “OK” ]
then
exit 0
elif [ “$sonar_status” = “ERROR” ]
then
echo “ERROR :: Please login sonarqubelink and find the issues [Code Quality and Code Security | SonarQube](https://sonarqube.com/dashboard?id=test-demo11)”
exit 1
fi
#curl -u admin: “[Code Quality and Code Security | SonarQube](https://sonarqube.com/api/issues/search?componentKeys=test-demo&types=BUG&ps=10&facets=severities%2Ctypes&additionalFields=_all)”
but We want
This is not possible except for very convoluted scripting, that I will not explain here, because what you’re trying to do is a bad practice.
It’s a bad practice because you should not only focus on the problems introduced between 2 builds, you should focus on the problems introduced since a particular past build of reference (that passes the quality gate).
Hi
We have maintained the last 10day new bugs,