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 208 forks source link

Sonar can not feedback report to gitlab when pull_request. #284

Open gth7754125 opened 4 years ago

gth7754125 commented 4 years ago

i use drone ci to trigger a sonar scan when a pull_request manually attached. However, it can create the report but don't feedback report at all. How to make it work? Somebody can help ?

- name: feedback
    image: maven:3-jdk-8
    volumes:
      - name: cache
        path: /root/.m2
    environment:
      SONAR_URL: http://sonar.****
      SONAR_LOGIN:
        from_secret: sonar_token
      CI_PROJECT_PATH: http://git.*****/wiki001/testproject
      CI_COMMIT_SHA: ${DRONE_COMMIT_SHA}
      CI_COMMIT_REF_NAME: ${DRONE_COMMIT_BRANCH}
      CI_PROJECT_ID: 11
    commands:
      - mvn --batch-mode verify sonar:sonar -Dsonar.host.url=$SONAR_URL -Dsonar.analysis.mode=preview -Dsonar.issuesReport.console.enable=true -Dsonar.gitlab.commit_sha=$CI_COMMIT_SHA -Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME
    when:
      branch:
        include:
          - develop
          - master
      event:
        include:
          - pull_request

Part of drone's logs here:

187 | [INFO] ------------- Run sensors on project
-- | --
188 | [INFO] No SCM system was detected. You can use the 'sonar.scm.provider' property to explicitly specify it.
189 | [INFO] Load server issues
190 | [INFO] Load server issues (done) \| time=92ms
191 | [INFO] Performing issue tracking
192 | [INFO] 11/11 components tracked
193 | [INFO] Load server rules
194 | [INFO] Load server rules (done) \| time=171ms
195 | [INFO] ANALYSIS SUCCESSFUL
196 | [INFO] Analysis total time: 6.432 s
197 | [INFO] ------------------------------------------------------------------------
198 | [INFO] BUILD SUCCESS
199 | [INFO] ------------------------------------------------------------------------
200 | [INFO] Total time:  26.587 s
201 | [INFO] Finished at: 2020-08-28T07:16:37Z