[WARNING] Shallow clone detected, no blame information will be provided. You can convert to non-shallow with 'git fetch --unshallow'.
sonarqube执行扫描代码时,报错上所示。导致不能将bug自动关联到责任人信息(责任人信息与sonarqube用户的SCM账号也有关系)。是因为git浅克隆的原因。需要在gitlab runner执行时,配置git fetch --unshallow || true。具体配置如下:
sonarqube-check:
stage: .pre
tags:
- sharedrunner
image: maven:3.6.3-jdk-11
variables:
SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache
GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task
cache:
key: "${CI_JOB_NAME}"
paths:
- .sonar/cache
before_script:
- git fetch --unshallow || true
script:
- mvn verify sonar:sonar -Dsonar.projectKey=rmis_rmis-backend_AYmRKhJ4OvT7Wd1RdzKi
allow_failure: true
only:
- master