Closed matblanco closed 5 years ago
Hi, Quality Gate is work with version >= 3.x plugin
Hi! Thanks for your answer! Today I installed sonar-gitlab-plugin 3.0.1 and I can see the quality gate in gitlab logs! But I can't see the quality gate in the global comments, only issues.
Have you changed global template ?
You are right! When global template is by default, I can see the quality gate in global comments! Thanks!
A last question. There is a way to see all issues using all-issues.md code, and also quality gate in Gitlab Global comments?
I would like to have the report from quality gate of Sonarqube in gitlab, just like this:
But I can only see the issues, and the job of gitlab always fails, even if the quality gate passed.
I used this code in my gitlab-ci.yml:
code_quality-analisis: stage: test image: ciricihq/gitlab-sonar-scanner script:
code_quality-report: stage: test image: ciricihq/gitlab-sonar-scanner variables: SONAR_URL: MY_SONAR_URL SONAR_ANALYSIS_MODE: publish script:
code_quality-gate: stage: test image: ciricihq/gitlab-sonar-scanner script:
and my sonar-project.properties is:
sonar.projectKey=prueba sonar.projectName=prueba sonar.projectVersion=1.0 sonar.sourceEncoding=UTF-8 sonar.sources=. sonar.exclusions = /node_modules/,*/.spec.ts sonar.host.url= MY_SONAR_URL sonar.scm.provider=git sonar.gitlab.project_id=git@MY_GIT_URL:mat/prueba.git sonar.gitlab.failure_notification_mode=exit-code sonar.login=8ab2... sonar.gitlab.ref_name=$CI_COMMIT_REF_NAME sonar.issuesReport.console.enable=true sonar.gitlab.user_token=... sonar.gitlab.url=MY_GIT_URL sonar.gitlab.all_issues=true
And my logs in gitlab:
$ sonar-scanner -Dsonar.analysis.mode=preview -Dsonar.gitlab.commit_sha=$CI_COMMIT_SHA INFO: Scanner configuration file: NONE INFO: Project root configuration file: /matblanco/prueba4/sonar-project.properties INFO: SonarQube Scanner 3.3.0.1492 INFO: Java 1.8.0_201 Oracle Corporation (64-bit) INFO: Linux 4.14.91+ amd64 INFO: User cache: /root/.sonar/cache INFO: SonarQube server 6.6.0 INFO: Default locale: "en_US", source code encoding: "UTF-8" INFO: Issues mode WARN: The use of the issues mode (sonar.analysis.mode=issues) is deprecated. This mode will be dropped in the future. INFO: Load global settings INFO: Load global settings (done) | time=681ms INFO: User cache: /root/.sonar/cache INFO: Exclude plugins: devcockpit, ldap, authgithub, authbitbucket, pdfreport, authaad, googleanalytics, governance INFO: Load plugins index INFO: Load plugins index (done) | time=357ms INFO: Download checkstyle-sonar-plugin-3.7.jar INFO: Download sonar-scm-git-plugin-1.2.jar INFO: Download sonar-gitlab-plugin-2.1.0.jar INFO: Download sonar-scm-svn-plugin-1.5.0.715.jar INFO: Download sonar-csharp-plugin-6.6.0.3969.jar INFO: Download sonar-javascript-plugin-3.3.0.5702.jar INFO: Download sonar-java-plugin-4.15.0.12310.jar INFO: Download sonar-php-plugin-2.11.0.2485.jar INFO: Download sonar-typescript-plugin-1.1.0.1079.jar INFO: Process project properties INFO: Load project repositories INFO: Load project repositories (done) | time=337ms INFO: GlobalWorkingDir null INFO: Scanning only changed files INFO: Execute project builders INFO: Execute project builders (done) | time=2205ms INFO: Load quality profiles INFO: Load quality profiles (done) | time=220ms INFO: Load active rules INFO: Load active rules (done) | time=2260ms INFO: Load metrics repository INFO: Load metrics repository (done) | time=248ms INFO: Project key: prueba INFO: ------------- Scan prueba INFO: Load server rules INFO: Load server rules (done) | time=1603ms INFO: Base dir: /matblanco/prueba4 INFO: Working dir: /matblanco/prueba4/.scannerwork INFO: Source paths: . INFO: Source encoding: UTF-8, default locale: en_US INFO: Index files INFO: Excluded sources: INFO: /node_modules/ INFO: */.spec.ts INFO: 10 files indexed INFO: 0 files ignored because of inclusion/exclusion patterns INFO: Quality profile for js: Sonar way copy INFO: Sensor SonarJavaXmlFileSensor [java] INFO: Sensor SonarJavaXmlFileSensor [java] (done) | time=5ms INFO: Sensor Analyzer for "php.ini" files [php] INFO: Sensor Analyzer for "php.ini" files [php] (done) | time=8ms INFO: Load server issues INFO: Load server issues (done) | time=606ms INFO: Performing issue tracking INFO: 13/13 components tracked INFO: ANALYSIS SUCCESSFUL INFO: Executing post-job GitLab Commit Issue Publisher INFO: ------------------------------------------------------------------------ INFO: EXECUTION FAILURE INFO: ------------------------------------------------------------------------ INFO: Total time: 1:13.914s INFO: Final Memory: 13M/109M INFO: ------------------------------------------------------------------------ ERROR: Error during SonarQube Scanner execution ERROR: Report status=failed, desc=SonarQube reported 47 issues, with 2 blocker (fail) and 6 critical and 5 major and 34 minor (fail) ERROR: ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging. ERROR: Job failed: command terminated with exit code 1