From cecfca8d6d8341d1d17147172e31bb5313132f28 Mon Sep 17 00:00:00 2001 From: Andrea Cavalli Date: Sat, 3 Oct 2020 14:15:58 +0200 Subject: [PATCH] Update Jenkinsfile --- Jenkinsfile | 102 ++++++++++++++++++++++++++++------------------------ 1 file changed, 55 insertions(+), 47 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 413c382..7cce9bc 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,54 +2,62 @@ // see https://jenkins.io/doc/book/pipeline/syntax/ pipeline { - environment { - MVN_SET = credentials('maven_settings') - } - agent { docker { image 'maven:3.6.3' } } - triggers { - pollSCM "* * * * *" - } - options { - timestamps() - ansiColor("xterm") - } - parameters { - booleanParam(name: "RELEASE", - description: "Build a release from current commit.", - defaultValue: false) - } - stages { + environment { + JAVA_TOOL_OPTIONS = '-Duser.home=/var/maven' + MVN_SET = credentials('maven_settings') + } + agent { + docker { + image 'maven:3.6.3' + args '-v $HOME:/var/maven' + reuseNode true + } + } + triggers { + pollSCM "* * * * *" + } + options { + timestamps() + ansiColor("xterm") + } + parameters { + booleanParam(name: "RELEASE", + description: "Build a release from current commit.", + defaultValue: false) + } + stages { - stage("Compile C++") { - steps { - sh "./jenkins/scripts/compile.sh" - } - } + stage("Compile C++") { + steps { + sh "./jenkins/scripts/compile.sh" + JAVA_TOOL_OPTIONS = '-Duser.home=/var/maven' + } + } - stage("Build & Deploy SNAPSHOT") { - steps { - sh "mvn -s $MVN_SET -B deploy" - } - } + stage("Build & Deploy SNAPSHOT") { + steps { + sh "mvn -s $MVN_SET -B deploy" + } + } - stage("Release") { - when { - expression { params.RELEASE } - } - steps { - sh "mvn -s $MVN_SET -B release:prepare" - sh "mvn -s $MVN_SET -B release:perform" - } - } - stage('Deliver') { - steps { - sh './jenkins/scripts/deliver.sh' - } - } - } - post { - always { - deleteDir() - } - } + stage("Release") { + when { + expression { params.RELEASE } + } + steps { + sh "mvn -s $MVN_SET -B release:prepare" + sh "mvn -s $MVN_SET -B release:perform" + } + } + stage('Deliver') { + steps { + sh './jenkins/scripts/deliver.sh' + } + } + } + post { + always { + deleteDir() + } + } }