Unable to invoke sonarqube from a gitlab Ci pipeline using docker

Hi All,

I am having some trouble invoking sonarqube scan in my Gitlab CI pipeline using docker image.
Following is the command i am running as per the documentation.

docker run --rm -v “$pwd:/usr/src” images.artifactory.company_name.com/sonarsource/sonar-scanner-cli:4.7 -Dsonar.branch.name=${CI_COMMIT_BRANCH} -Dsonar.projectKey=${CI_PROJECT_NAME} -Dsonar.login=${SONAR_TOKEN} -Dsonar.host.url=${SONAR_HOST_URL}

and it is being triggered from the directory where i need to run the scan (verified by echoing the pwd variable in pipeline)

still everytime it says in the logs that "0 Files Indexed

Not able to understand what is the issue, and i am trying to run this scan on python language.
Can anyone help me with this.

Hey there.

I would suggest including logs from the analysis, and redacting sensitive information if necessary. Turning on DEBUG logging (adding -X to your scanner command) will also be useful.

Hey Colin ,

I tried turning on Debug logging mode, but still not able to understand the issue.
As stated, I am attaching the log for reference, it will be really great if this can be resolved.
sonar_scan.log (39.0 KB)

Attaching the image where, I am echoing the $pwd to check if I am in the right directory where files needs to be analysed, it is also giving the right result.
image

What if you run an ls right before the sonar-scanner command? Do you see files?

Yes i am able to see the files.

This is the output i am getting after running ls command.
image

But is this actually running from within the context of your Gitlab pipeline, not a manual execution on the filesystem?

Hi @Colin ,

Yes all the above snippets are from pipeline run only.