Gitlab CI sonar-scanner fails to process submodule

I have created a SonarCloud project for a Python project that contains git submodules. sonar-scanner fails to handle git submodule when Checking cache for sonarcloud-check….

I have only configured the parent project, XYZ, for SonarCloud. Do I need to configure the submodule project as well? I’m a bit lost as to what I am missing in our configuration.

  • ALM used GitLab
  • CI system used GitLab
  • Scanner command used when applicable (private details masked)
sonar-scanner

sonar-project.properties

sonar.projectKey=ABC_XYZ
sonar.organization=**************
# debug 
sonar.verbose=true
sonar.log.level=DEBUG
  • Languages of the repository
    Python

  • Error observed (wrap logs/code around with triple quotes ``` for proper formatting)

Getting source from Git repository
$ eval "$CI_PRE_CLONE_SCRIPT"
Fetching changes...
Initialized empty Git repository in /builds/ABC/XYZ/.git/
Created fresh repository.
Checking out 2622c362 as development...
Updating/initializing submodules recursively...
Submodule 'batch/common' (https://gitlab-ci-token:[MASKED]@gitlab.com/***/common.git) registered for path 'batch/common'
Cloning into '/builds/ABC/XYZ/batch/common'...
Submodule path 'batch/common': checked out '8f4..32a'
Entering 'batch/common'
section_end:1596553150:get_sources
section_start:1596553150:restore_cache
Restoring cache
Checking cache for sonarcloud-check...
FATAL: file does not exist                        
Failed to extract cache
2 Likes

Welcome to the community!

It seems your post got overlooked, sorry for the late response.

From the output you included, it seems to me the scanner wasn’t reached. That is, the failure seems to happen while GitLab is initializing the working tree. I noticed a recent similar thread that had experienced the same symptoms, and the cause of the problem was a misconfiguration of the build scripts. Can you please check on that?

threat 130 doesnt help at all, it is different case.

Hey @Natannegara – let me suggest you raise a new thread with the full details of the issue you’re facing instead of bumping a thread that has been inactive for over a year. I’ll close this thread.

Colin