gitjenkinssonarqubeshallow-clone

SonarQube with shallow clone warning even with shallow disabled on Jenkins build


I have a Jenkins server building a solution using MSBuild. Shallow Clone is not enabled (on Advanced Clone Behaviours), so I supposed it's getting all the last commits. And I'm using SonarQube to analyze. I set to run the Begin Analysis before build and the End Analysis after build is complete. The SonarQube Analysis finishes successfully, but I'm receiving a warning:

Shallow clone detected during the analysis. Some files will miss SCM information. This will affect features like auto-assignment of issues. Please configure your build to disable shallow clone.

Someone knows what I'm missing to SonarQube works fine?


Solution

  • I have fixed! When I disabled the Shallow Clone on Jenkins, it was still missing the past commits, so I had to run some commands on GIT bash inside the repository folder:

    git fetch --depth=1000000
    

    (unless you have more than 1 million commits)

    then to confirm that I have removed the shallow:

    git fetch --unshallow
    

    After wait the next build and analysis, now has disappeared the warning and I can see the authors!