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?
I was getting the same warning in sonarcloud for one of my github repository integrated with sonarcloud.
So if someone is looking for the option to disable shallow clone in github actions workflow, then just edit the yml
file and use the fetch-depth: 0
option with actions/checkout@v2
step to disable shallow clone.
The complete example is mentioned below
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
For more detailed information visit - https://github.com/actions/checkout#fetch-all-history-for-all-tags-and-branches
As described in documentation: https://docs.travis-ci.com/user/customizing-the-build#sts=Git%20Clone%20Depth%20#
Just disable git fetch depth limit in .travis.yml
as follows:
git:
depth: false
Otherwise you are git cloning twice.
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!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With