From 7a3ba8764a65ae3ea85928d804a6e93b59c53059 Mon Sep 17 00:00:00 2001
From: Pierre Smeyers <pierre.smeyers@orange.com>
Date: Tue, 15 Jun 2021 18:37:56 +0200
Subject: [PATCH] fix: prevent shallow git clone (required by Sonar Scanner)

---
 templates/gitlab-ci-sonar.yml | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/templates/gitlab-ci-sonar.yml b/templates/gitlab-ci-sonar.yml
index 9426b28..7b82087 100644
--- a/templates/gitlab-ci-sonar.yml
+++ b/templates/gitlab-ci-sonar.yml
@@ -292,6 +292,10 @@ sonar:
   services:
     - name: "$CI_REGISTRY/to-be-continuous/tools/tracking:master"
       command: ["--service", "sonar", "1.3.1" ]
+  variables:
+    # Tells git to fetch all the branches of the project, required by the analysis task
+    # see: https://docs.sonarqube.org/8.5/analysis/gitlab-cicd/#header-2
+    GIT_DEPTH: 0
   before_script:
     - *sonar-scripts
     - install_ca_certs "${CUSTOM_CA_CERTS:-$DEFAULT_CA_CERTS}"
-- 
GitLab