gabrie-allaigre / sonar-gitlab-plugin

Add to each commit GitLab in a global commentary on the new anomalies added by this commit and add comment lines of modified files
GNU Lesser General Public License v3.0
713 stars 207 forks source link

External build always failing even if the quality gate set is pass. #165

Open asircar opened 6 years ago

asircar commented 6 years ago

External build always fails with the error:

SonarQube analysis indicates that quality gate is failed. Open Issues is failed: Actual value 3 > 0

Even though the open issues has been explicitly set to fail only if its greater than 10 in the quality gate.

gabrie-allaigre commented 6 years ago

Hi, Get me command line and full log please.

asircar commented 6 years ago

We are using GitLab and Hybris and so the job is triggered by the ant sonar task of Hybris with the all the properties being set. The only thing we need to know is from where is this setting being set which fails the build saying -

[image: Screen Shot 2018-08-28 at 2.42.33 PM.png]

We are not able to figure out from where the Open issues gate is set to fail at any open issue. We want it to respect the quality gate which we have set, which is set to fail when a critical or a blocker is found but as of now even if an info issue is found the stage breaks as we are not able to figure out from where the Open Issue gate is getting set.

Logs - [sonar:sonar] Quality gate status: ERROR [sonar:sonar] Open Issues: 2 > 0 [sonar:sonar] Reopened Issues : 0 [sonar:sonar] Report status=failed, desc=SonarQube reported QualityGate is error, with 1 error and 1 ok, 2 issues, with 1 major and 1 info

On Mon, Aug 27, 2018 at 2:59 AM Gabriel Allaigre notifications@github.com wrote:

Hi, Get me command line and full log please.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/gabrie-allaigre/sonar-gitlab-plugin/issues/165#issuecomment-416073723, or mute the thread https://github.com/notifications/unsubscribe-auth/AKzWi9U_5jcAgLC8XVgBlsx0WDJFaf29ks5uUxNSgaJpZM4WKcaz .

gabrie-allaigre commented 6 years ago

@asircar Hi, I don't show image

asircar commented 6 years ago
screen shot 2018-08-28 at 2 42 33 pm
gabrie-allaigre commented 6 years ago

Use branch plugin in Sonar ?

asircar commented 6 years ago

Yes, branch plugin is installed.

gabrie-allaigre commented 6 years ago

Have you a screenshot for Quality Gate in Sonarqube ?

asircar commented 6 years ago
screen shot 2018-08-28 at 2 56 06 pm

As you can see, I have added the Open Issues in the Quality Gate to fail only when it is over 10, but still it is failing even when there is 1 open issue.

gabrie-allaigre commented 6 years ago

Your project use this quality gate ?

asircar commented 6 years ago

Yes

gabrie-allaigre commented 6 years ago

Ok, For Short-lived branch, quality gate is hard coded https://docs.sonarqube.org/display/SONAR/Short-lived+Branches For use your quality gate, you use Long-lived branch

Piyush041983 commented 4 years ago

Hello @gabrie-allaigre

I am new to CI and sonar qube.My organisation is expecting a successful PoC of complete gitlab CI pipeline to be run for all the projects. So I have done everything and just stuck in sonar qube .Integrated sonar qube with gitlab, set some metric for quality gate. Also when sonar scanner job completed then I can see the quality gate reports as pass or fail .

I am just doing a PoC in a sample project and in master branch . But can't understand what should be the commands to get the proper results both in quality gate and gitlab CI. I am confused what should be the error notification mode? commit-status or exit-code?

I am seeing various results like if quality gate is getting failed then in ci showing execution successful and job succeeded.and vice versa .

My team expect that if quality gate gets fail then ci will be failed,if quality gate success then ci also should show success.cant understand how to achieve these milestones. Give me proper commands to achieve these target Sorry ..query became so lengthy but I am completely confused.

Please help

swapnilpotnis commented 4 years ago
stage("SonarQube Quality Gate") { 
            timeout(time: 1, unit: 'HOURS') { 
            def qg = waitForQualityGate() 
            if (qg.status != 'OK') {
                error "Pipeline ABORTED due to Quality Gate Failure: ${qg.status}"
                args.AbortPipeline();
                return;
                }
            }
        }

@Piyush041983 : use the above stage to mark the pipeline as FAILURE for QualityGate FAILURE