Closed SruthiMohan2910 closed 5 years ago
Hi, Plugin break only if critical or blocked issue, if you break others issue, set attributes
-Dsonar.gitlab.max_major_issues_gate=0
-Dsonar.gitlab.max_minor_issues_gate=0
-Dsonar.gitlab.max_info_issues_gate=0
Thank you so much for the response. But this will only work on "publish" mode. I wanted the pipeline to break on "preview" mode. So I made a shortcut to fix my problem by making few changes in my pipeline (I am not sure if its an optimal solution):
stages:
- code_quality
variables:
SONAR_LOGIN: "xyz"
SONAR_PASSWORD: "xyz"
SOURCE: "."
PREVIEW_RES: ""
sonarqube_master_job:
stage: code_quality
tags:
- docker
only:
- development
- merge_requests
script:
- cd ..
- PREVIEW_RES="$(sonar-scanner/bin/sonar-scanner -Dsonar.login=$SONAR_LOGIN -Dsonar.password=$SONAR_PASSWORD -Dsonar.sources=$SOURCE -Dsonar.analysis.mode=preview -Dsonar.issuesReport.console.enable=true -Dsonar.gitlab.failure_notification_mode=exit-code -Dsonar.projectVersion=$VERSION)"
# - echo $PREVIEW_RES
- (if [[ $PREVIEW_RES == *"No new issue"* ]]; then exit 0; else exit 1; fi);
I need the GitLab 'code_quality' job to fail if it finds atleast 1 major issue in preview mode. But everytime the Job succeeds. I have already set the gitlab.max_major_issues_gate=0 inside sonar-scanner.properties, still it doesn't work. @gabrie-allaigre Please help!!!
This is my .gitlab-ci.yml