The issue here is ownership of the files/directories under .sonar/cache
, when this directory is kept in cache and restaured between GitLab-CI jobs execution.
GitLab-CI does preserve ownership (which user/group owns each file/directory) for such caches. See for instance this comment in a GitLab issue on this topic.
Until this morning, the sonarsource/sonar-scanner-cli:latest
image was version 5.0.1, and in this image jobs were executed as user root:root
. It has been changed to new images (10.0.1.1390_5.0.1 and then 10.0.2.1398_5.0.1), and with these images jobs are executed as sonar-cli:sonar-cli
(1000:1000
). A .sonar/cache
directory from a cache built yesterday will thus have the wrong ownership, leading to various scanner fatal errors: you got an AccessDeniedException
, I’ve seen some ClassNotFoundException
(which was less explicit about the underlying issue).
As a workaround, you can clear your runner cache for the GitLab project.