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

Gitlab/Jenkins/Sonar : gitlab pipelines 'pending' at sonarqube step, nothing published #246

Open squalou opened 5 years ago

squalou commented 5 years ago

Hi,

I've tried to set this up :

All these on premises

When the jenkins job launches this :

mvn sonar:sonar -Dsonar.branch=$branchName -Dsonar.analysis.mode=preview -Dsonar.gitlab.project_id=$project_id -Dsonar.gitlab.commit_sha=$commit_sha -Dsonar.gitlab_ref=$branchName

Gitlab logs this (among piles of other things :) )

{"time":"2019-06-06T20:21:45.714Z","severity":"INFO","duration":69.8,"db":8.01,"view":61.79,"status":201,"method":"POST","path":"/api/v4/projects/84/statuses/fe05647ab1d13a8bf276efebf7724bd18448b745","params":[{"key":"name","value":"sonarqube"},{"key":"description","value":"SonarQube analysis in progress"},{"key":"state","value":"pending"}],"host":"gitlab.myhost.com","ip":"23.09.11.96, 172.0.0.11, 22.109.91.9","ua":"Java/1.8.0_171","route":"/api/:version/projects/:id/statuses/:sha","user_id":16,"username":"sonar","queue_duration":2.89,"gitaly_calls":4,"gitaly_duration":21.96,"correlation_id":"H4ZZcEHShl5"}

The CI/CD 'pipeline' displays a 'sonarqube' step in 'running' state. This tends to proove that the connexion works. I've checked that 'sonar' user has the developer role on the project.

...

but that's all

Maven command ends successfully BUT no sonar anlysis reports are available Gitlab and the 'pipeline' stays 'running'

Now,if I remove 'preview mode'

Maven command is successful, Sonar reports is published on Sonar Nothing is published on Gitlab and the 'pipeline' stays 'running'

Is there anywhere I should look for addition logs ?

What is supposed to tell Gitlab that sonarqube has ended ?

Any idea why the preview mode ends with this 'unable to locate report', is it expected ?

Any help sorting this out will be much appreciated.

00:16:32 [INFO] Quality profile for java: Sonar way 
00:16:34 [INFO] Sensor JavaXmlSensor [java]
00:16:34 [INFO] Sensor JavaXmlSensor [java] (done) | time=3ms

... etc

00:16:34 [INFO] Performing issue tracking
00:16:34 [INFO] 142/142 components tracked
00:16:34 [INFO] ANALYSIS SUCCESSFUL
00:16:34 [INFO] Task total time: 3.588 s
00:16:34 [INFO] ------------------------------------------------------------------------
00:16:34 [INFO] BUILD SUCCESS
00:16:34 [INFO] ------------------------------------------------------------------------
00:16:34 [INFO] Total time: 10.602 s
00:16:34 [INFO] Finished at: 2019-06-07T00:16:34+02:00
00:16:34 [INFO] Final Memory: 52M/512M
00:16:34 [INFO] ------------------------------------------------------------------------
[Pipeline] }
00:16:34 WARN: Unable to locate 'report-task.txt' in the workspace. Did the SonarScanner succedeed?
dmpanch commented 4 years ago

Same here for a months.

Sonar scanner log:

+ sonar-scanner
INFO: Scanner configuration file: NONE
INFO: Project root configuration file: /home/jenkins/workspace/panel-web-interface/sonar-project.properties
INFO: SonarQube Scanner 4.2.0.1873
INFO: Java 11.0.3 AdoptOpenJDK (64-bit)
INFO: Linux 4.15.0-88-generic amd64
INFO: User cache: /root/.sonar/cache
INFO: SonarQube server 8.3.1
INFO: Default locale: "en_US", source code encoding: "UTF-8" (analysis is platform dependent)
INFO: Load global settings
INFO: Load global settings (done) | time=164ms
INFO: Server id: 84ABEE94-AXAcGpPJK_MK0QpAXZ0a
INFO: User cache: /root/.sonar/cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=31ms
INFO: Load/download plugins (done) | time=9672ms
INFO: Process project properties
INFO: Process project properties (done) | time=0ms
INFO: Execute project builders
INFO: Execute project builders (done) | time=3ms
INFO: Project key: panel-web-interface
INFO: Base dir: /home/jenkins/workspace/panel-web-interface
INFO: Working dir: /home/jenkins/workspace/panel-web-interface/.scannerwork
INFO: Load project settings for component key: 'panel-web-interface'
INFO: Load project settings for component key: 'panel-web-interface' (done) | time=39ms
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=81ms
INFO: Auto-configuring with CI 'Jenkins'
INFO: Load active rules
INFO: Load active rules (done) | time=1091ms
INFO: Indexing files...
INFO: Project configuration:
INFO: Load project repositories
INFO: Load project repositories (done) | time=48ms
INFO: 271 files indexed
INFO: 0 files ignored because of scm ignore settings
INFO: Quality profile for css: Sonar way
INFO: Quality profile for js: Sonar way
INFO: Quality profile for web: Sonar way
INFO: Quality profile for xml: Sonar way
INFO: ------------- Run sensors on module panel-web-interface
INFO: Load metrics repository
INFO: Load metrics repository (done) | time=30ms
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by net.sf.cglib.core.ReflectUtils$1 (file:/root/.sonar/cache/54f6535c111cefad0fb6a09ba3e61922/sonar-javascript-plugin.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of net.sf.cglib.core.ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
INFO: Sensor SonarCSS Metrics [cssfamily]
INFO: Sensor SonarCSS Metrics [cssfamily] (done) | time=45ms
INFO: Sensor SonarCSS Rules [cssfamily]
INFO: 80 source files to be analyzed
INFO: 80/80 source files have been analyzed
INFO: Sensor SonarCSS Rules [cssfamily] (done) | time=1095ms
INFO: Sensor JaCoCo XML Report Importer [jacoco]
INFO: 'sonar.coverage.jacoco.xmlReportPaths' is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
INFO: No report imported, no coverage information will be imported by JaCoCo XML Report Importer
INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=2ms
INFO: Sensor JavaScript analysis [javascript]
INFO: 141 source files to be analyzed
INFO: 141/141 source files have been analyzed
INFO: Sensor SonarJS [javascript]
INFO: 141 source files to be analyzed
INFO: Sensor SonarJS [javascript] (done) | time=1592ms
INFO: Sensor JavaScript analysis [javascript] (done) | time=5393ms
INFO: 141/141 source files have been analyzed
INFO: Sensor JavaXmlSensor [java]
INFO: 1 source files to be analyzed
INFO: Sensor JavaXmlSensor [java] (done) | time=88ms
INFO: Sensor HTML [web]
INFO: 1/1 source files have been analyzed
INFO: Sensor HTML [web] (done) | time=93ms
INFO: Sensor XML Sensor [xml]
INFO: 1 source files to be analyzed
INFO: Sensor XML Sensor [xml] (done) | time=61ms
INFO: 1/1 source files have been analyzed
INFO: ------------- Run sensors on project
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=18ms
INFO: CPD Executor 42 files had no CPD blocks
INFO: CPD Executor Calculating CPD for 101 files
INFO: CPD Executor CPD calculation finished (done) | time=45ms
INFO: Analysis report generated in 50ms, dir size=880 KB
INFO: Analysis report compressed in 193ms, zip size=427 KB
INFO: Analysis report uploaded in 124ms
INFO: ANALYSIS SUCCESSFUL, you can browse http://sonarqube:9000/dashboard?id=panel-web-interface
INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
INFO: More about the report processing at http://sonarqube:9000/api/ce/task?id=AXI5dWA9ejPFXOIPDMLN
INFO: Analysis total time: 10.168 s
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 22.807s
INFO: Final Memory: 14M/57M
INFO: ----------------------------