Skip to content

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

@gth7754125

Description

@gth7754125

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions