From 0a40c14a2c2039da235600667cdef2c793df1583 Mon Sep 17 00:00:00 2001
From: Raphael Defosseux <raphael.defosseux@eurecom.fr>
Date: Wed, 4 Sep 2019 10:44:06 +0200
Subject: [PATCH] CI: add the ccpcheck stage

Signed-off-by: Raphael Defosseux <raphael.defosseux@eurecom.fr>
---
 ci-scripts/Jenkinsfile-gitlab-nb-iot | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/ci-scripts/Jenkinsfile-gitlab-nb-iot b/ci-scripts/Jenkinsfile-gitlab-nb-iot
index d339f5ddb8..15ff747e2d 100644
--- a/ci-scripts/Jenkinsfile-gitlab-nb-iot
+++ b/ci-scripts/Jenkinsfile-gitlab-nb-iot
@@ -31,7 +31,7 @@ pipeline {
         disableConcurrentBuilds()
         timestamps()
         gitLabConnection('OAI GitLab')
-        gitlabBuilds(builds: ["Build eNb-USRP", "Build phy-sim", "Build eNb-ethernet", "Build UE-ethernet"])
+        gitlabBuilds(builds: ["Build eNb-USRP", "Build phy-sim", "Build eNb-ethernet", "Build UE-ethernet", "Analysis with cppcheck"])
         ansiColor('xterm')
     }
 
@@ -131,8 +131,25 @@ pipeline {
             }
         }
 
+        stage ("Start VM -- cppcheck") {
+            steps {
+                timeout (time: 5, unit: 'MINUTES') {
+                    sh "./ci-scripts/oai-ci-vm-tool build --workspace $WORKSPACE --variant cppcheck --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
+                }
+            }
+        }
+
         stage ("Variant Builds") {
             parallel {
+                stage ("Analysis with cppcheck") {
+                    steps {
+                        gitlabCommitStatus(name: "Analysis with cppcheck") {
+                            timeout (time: 20, unit: 'MINUTES') {
+                                sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant cppcheck --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
+                            }
+                        }
+                    }
+                }
                 stage ("Build eNb-USRP") {
                     steps {
                         gitlabCommitStatus(name: "Build eNb-USRP") {
@@ -179,7 +196,7 @@ pipeline {
                 always {
                     script {
                         dir ('archives') {
-                            sh "zip -r -qq vm_build_logs.zip enb_usrp phy_sim enb_eth ue_eth"
+                            sh "zip -r -qq vm_build_logs.zip enb_usrp phy_sim enb_eth ue_eth cppcheck"
                         }
                         if(fileExists('archives/vm_build_logs.zip')) {
                             archiveArtifacts artifacts: 'archives/vm_build_logs.zip'
-- 
2.26.2