Files
maptology/Jenkinsfile
T
handte c38c9d0754
lbs-gitea/maptology/master This commit looks good
Fetch jenkins build number and set it during maven build.
Retrieve jenkins build number from env.BUILD_NUMBER and set it as
jenkins.build.number to make it available via versions endpoint on
maptology (i.e. https://www.maptology.com/api/version/build).
2017-12-12 08:42:31 +01:00

39 lines
1.1 KiB
Groovy

#!groovy
// this groovy script is executed by jenkins
node {
// configure maven path for 3.3.9
def mvnHome = tool 'Maven 3.3.9'
// checkout code from scm
stage('Checkout') {
checkout scm
}
// delete target directories
stage('Clean') {
sh "${mvnHome}/bin/mvn -B clean"
}
// build the source code with release profile
stage('Build') {
withCredentials([string(credentialsId: '633354f3-c59b-48cb-92e1-a22b29134779', variable: 'PASSWD')]) {
sh "${mvnHome}/bin/mvn -Prelease -Djenkins.build.number=${env.BUILD_NUMBER} -Dkey.password=$PASSWD -B verify"
}
}
// deploy the final ear
stage ('Deploy') {
if (env.BRANCH_NAME == "master") {
withCredentials([sshUserPrivateKey(credentialsId: "729686c1-d1d2-4340-8e35-148feff7d3ec", keyFileVariable: "keyfile")]) {
sh "scp -i ${keyfile} ear/target/maptology.ear wildfly@srv.nes.uni-due.de:/opt/wildfly-10.1.0.final/standalone/deployments/maptology.ear"
sh "scp -i ${keyfile} android/app/target/*.apk wildfly@srv.nes.uni-due.de:/opt/android/"
}
} else {
echo "Skipping deployment for non-master branch."
}
}
}