LocationBasedServices/rema/pipeline/head There was a failure building this commit
40 lines
1.5 KiB
Groovy
40 lines
1.5 KiB
Groovy
#!groovy
|
|
|
|
// this groovy script is executed by jenkins
|
|
node('built-in') {
|
|
|
|
// use jdk 17 for building
|
|
jdk = tool name: 'openjdk-17'
|
|
env.JAVA_HOME = "${jdk}"
|
|
|
|
// checkout code from scm
|
|
stage('Checkout') {
|
|
checkout scm
|
|
}
|
|
|
|
// build the source code with build number
|
|
stage('Build') {
|
|
sh(script: './gradlew clean build', label: 'Build project.')
|
|
}
|
|
|
|
// deploy the build output on the server
|
|
stage ('Deploy') {
|
|
if (env.BRANCH_NAME == "master") {
|
|
echo "Deploying to production server ..."
|
|
withCredentials([sshUserPrivateKey(credentialsId: "mobydex-server-key", keyFileVariable: "KEYFILE")]) {
|
|
sh 'scp -i $KEYFILE rema-webapp/build/libs/rema-app.war mobydex@sun.nes.uni-due.de:/home/mobydex/wildfly-30.0.0.Final/standalone/deployments/rema-app.war'
|
|
sh 'scp -i $KEYFILE rema-service/build/libs/rema-service.war mobydex@sun.nes.uni-due.de:/home/mobydex/wildfly-30.0.0.Final/standalone/deployments/rema-service.war'
|
|
sh 'scp -i $KEYFILE rema-realtime/build/libs/rema-realtime.war mobydex@sun.nes.uni-due.de:/home/mobydex/realtime/rema-realtime.war'
|
|
sh 'ssh -i $KEYFILE mobydex@sun.nes.uni-due.de "sudo /bin/systemctl restart mobydex-realtime.service"'
|
|
}
|
|
withCredentials([sshUserPrivateKey(credentialsId: "innamoruhr-server-key", keyFileVariable: "KEYFILE")]) {
|
|
sh 'rsync -avz -e "ssh -i $KEYFILE" rema-visual-2/build/ wildfly@apps-pro.nes.uni-due.de:/opt/mobydex/rema-visual-2/'
|
|
}
|
|
} else {
|
|
echo "Skipping deployment for non-master branch."
|
|
}
|
|
}
|
|
|
|
}
|
|
|