From 4f0961db3a46c3f170ae3da433a6023f8222271a Mon Sep 17 00:00:00 2001
From: Homada Boumedane <homada.boumedane@unige.ch>
Date: Tue, 25 Jun 2019 14:35:41 +0200
Subject: [PATCH] chore(dlcm-portal): add deploy stage

add deploy stage to the pipeline
---
 Jenkinsfile | 44 +++++++++++++++++++-------------------------
 1 file changed, 19 insertions(+), 25 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index 4cbf199ba..2f8b0ec1f 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1,7 +1,17 @@
 pipeline{
 
   agent any
-  environment {
+
+  options{
+    buildDiscarder(logRotator(numToKeepStr: '5'))
+    disableConcurrentBuilds()
+  }
+
+  tools{
+    maven 'Maven'
+  }
+
+  environment{
     CHROME_BIN = '/usr/bin/chromium'
   }
 
@@ -34,34 +44,18 @@ pipeline{
     }
 
     stage ('Build'){
-      when {
-        branch 'master'
-      }
-      steps{
-        sh 'ng build --aot=true --prod=true'
+      steps {
+        withMaven(maven: 'Maven', mavenLocalRepo: '.repository'){
+          sh "mvn clean package"
+        }
       }
     }
 
-    stage('Archive'){
-       when {
-          branch 'master'
-       }
-       steps {
-         echo 'Archive....'
-         sh '''
-         cd dist
-         tar -cvzf ../dlcm-angular.tar.gz *
-         '''
-         archive 'dlcm-angular.tar.gz'
-       }
-    }
-
-    stage('Deploying'){
-      when {
-        branch 'master'
-      }
+    stage ('Deploying'){
       steps {
-        echo 'Deploying....'
+        withCredentials([sshUserPrivateKey(credentialsId: 'GitLab', keyFileVariable: 'RSA_KEY')]){
+          sh "mvn deploy"
+        }
       }
     }
 
-- 
GitLab