Hi I am trying to implement sonarqube using gitlab. I followed tutorial and videos to setup. But I end up with following error while pipeline is running at gitlab.
Checking cache for sonarqube-check…
Runtime platform arch=amd64 os=linux pid=1599937 revision=32fc1585 version=15.2.1
No URL provided, cache will not be downloaded from shared cache server. Instead a local version of cache will be extracted.
Successfully extracted cache
Executing “step_script” stage of the job script
$ sonar-scanner bash: line 120: sonar-scanner: command not found
Cleaning up project directory and file based variables
ERROR: Job failed: exit status 1
P.S while I tried to run sonar-scanner command through project directory then it is executing successfully. I don’t know what is it I am missing? My sonar-project.properties file is as below:-
We tried to reproduce the issue by running the scanner on gitlab.com with the default runners.
We got a slightly different output from GitLab. We have some extra lines on our output with the docker image used.
I suggest that you try to run on a GitLab default runner and see if the issue still persists.
Also, can you send us a screenshot of the logs in GitLab or the complete file to help us understand better if the image is downloaded or not?
All the suggested gitlab-ci.yml configurations that we provide for SonarQube can only run on runners that implement a docker executor. You can see more information about executors in the GitLab documentation.
In your case, as you can see in your logs, your runner doesn’t implement a docker executor and falls back to a shell executor which fails. The solution is to configure a runner with a docker executor to properly use the image that is provided in the CI file.
I created a ticket for improving our GitLab documentation that you can track here.