From c80694f450b04698cdf6c2f20e904137d6f61546 Mon Sep 17 00:00:00 2001
From: FORESTIER Fabien <fabien.forestier@soprasteria.com>
Date: Thu, 6 Feb 2020 16:30:53 +0100
Subject: [PATCH] Add sonarqube analysis job in gitlab-ci file.

---
 .gitlab-ci.yml | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 1a3407a..2895201 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,9 +1,29 @@
 stages:
+  - sonar-analysis
   - build
   - deploy
 
 variables:
   PROXY_HOST_TARGET: https://download.data.grandlyon.com
+  SONAR_URL: https://sonarqube.forge.grandlyon.com
+
+sonarqube:
+  stage: sonar-analysis
+  only:
+    - development
+  before_script:
+    - export PATH=$PATH:/usr/local/bin/sonar-scanner-3.2.0.1227-linux/bin/
+    - export NODE_PATH=$NODE_PATH:`npm root -g`
+  script:
+    - >
+      sonar-scanner
+      -Dsonar.projectName=${SONAR_PROJECT_KEY}
+      -Dsonar.projectVersion=1.0
+      -Dsonar.sourceEncoding=UTF-8
+      -Dsonar.projectBaseDir=.
+      -Dsonar.host.url=${SONAR_URL}
+      -Dsonar.projectKey=${SONAR_PROJECT_KEY}
+      -Dsonar.login=${SONAR_TOKEN}
 
 build_development:
   stage: build
-- 
GitLab