Gitlab shallow clone settings and sonarqube warnings

INFO: SCM Publisher SCM provider for this project is: git
INFO: SCM Publisher 7 source files to be analyzed
WARN: Shallow clone detected, no blame information will be provided. You can convert to non-shallow with 'git fetch --unshallow'.
INFO: SCM Publisher 0/7 source files have been analyzed (done) | time=4ms
WARN: Missing blame information for the following files:
WARN:   * db/schema.rb
WARN:   * spec/spec_helper.rb
WARN:   * spec/requests/api/v1/individual_entities_spec.rb
WARN:   * app/serializers/domain/entity/model/individual_entity_serializer.rb
WARN:   * db/migrate/entity/20200206072952_create_individual_entity.rb
WARN:   * app/ddd/api_layer/controllers/api/v1/individual_entities_controller.rb
WARN:   * spec/domain/entity/aggregates/individual_entity_aggregate_spec.rb
WARN: This may lead to missing/broken features in SonarQube
INFO: CPD Executor 39 files had no CPD blocks
INFO: CPD Executor Calculating CPD for 139 files
INFO: CPD Executor CPD calculation finished (done) | time=66ms
INFO: Analysis report generated in 165ms, dir size=504 KB
INFO: Analysis report compressed in 339ms, zip size=326 KB
INFO: Analysis report uploaded in 705ms
INFO: ------------- Check Quality Gate status
INFO: Waiting for the analysis report to be processed (max 300s)
INFO: ------------------------------------------------------------------------
INFO: ------------------------------------------------------------------------
INFO: Total time: 46.828s
INFO: Final Memory: 41M/119M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution

I have set the variable GIT_DEPTH : 0 in gitlab .gitlab-ci.yaml file (as told in the documentation). I still get the warning from sonarqube.

SonarQube           :
  variables         :
    GIT_DEPTH       : 0
  image             : 
    name            : sonarsource/sonar-scanner-cli:latest
    entrypoint      : [""]
  stage             : code-analysis
  tags              :
                    - ruby-in-docker
  before_script     :
                    - echo "Running SonarQube analysis"
                    - sonar-scanner -v
  script            : 
                    - sonar-scanner -Dsonar.qualitygate.wait=true
  allow_failure     : true
  only              :
                    - master

Sonarqube server: * Community Edition * Version 8.1 (build 31237)
Sonar-scanner: sonarsource/sonar-scanner-cli:latest

if I set the GIT_DEPTH : 100 and the warning goes away, but it is a temporary solution, I am afraid.


Have you tried to pass the GIT_DEPTH value as string?