rsemcs/Jenkinsfile

58 lines
2.1 KiB
Groovy

pipeline {
agent any
stages {
stage("integrate modpack") {
when {
branch '**/develop'
}
steps {
sshagent(['108c5045-64d1-42a6-acd7-a39da5e096d1']) {
sh "git fetch"
sh "git checkout -B latest-modpack"
sh "git merge -X theirs origin/develop"
sh "chmod u+x ./scripts/*.sh"
sh "./scripts/update_modpack.sh"
}
}
}
stage("server launch test") {
steps {
sh 'echo "eula=true" > eula.txt'
sh "chmod u+x ./run.sh"
lock('Port 25565') {
sh 'echo "stop" | ./run.sh'
}
logParser failBuildOnError: true, projectRulePath: 'Jenkinsparse', parsingRulesPath: 'Jenkinsparse', showGraphs: true, unstableOnWarning: true, useProjectRule: true
}
}
stage("commit changes") {
when {
branch '**/develop'
}
steps {
sh "git clean -dfX"
sh "git add mods/**"
sh "git add config/**"
sh "git commit -a -m 'Automatic integration of latest modpack.' && exit 0"
sshagent(['108c5045-64d1-42a6-acd7-a39da5e096d1']) {
sh "git pull -X theirs origin latest-modpack"
sh "git push --set-upstream origin latest-modpack"
}
}
}
stage("deploy") {
when {
branch '**/master'
}
steps {
sh "git clean -dfX"
sh "rm -rf world"
sshagent(['ce4c701d-098c-4706-8f32-c0af996a7769']) {
sh "ssh -o StrictHostKeyChecking=no gamehost@entertainment 'systemctl --user stop rsemcs'"
sh "rsync -a --update --delete-after ./** gamehost@entertainment:/home/gamehost/mcserver/"
sh "ssh gamehost@entertainment 'systemctl --user start rsemcs'"
}
}
}
}
}