rsemcs/Jenkinsfile

63 lines
2.2 KiB
Groovy

pipeline {
agent any
stages {
stage("integrate modpack") {
when {
branch '**/sync-modpack'
}
steps {
sshagent(['eb018bad-5d56-4306-a006-60fb7cf194aa']) {
sh "git fetch"
sh "git checkout origin/develop"
sh "git merge -X theirs origin/sync-modpack"
sh "chmod u+x ./scripts/*.sh"
sh "./scripts/update_modpack.sh"
}
}
}
stage("server launch test") {
when {
not {
branch '**/sync-modpack'
}
}
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 '**/sync-modpack'
}
steps {
sh "git clean -dfX"
sh "git add mods/**"
sh "git add config/**"
sh "git commit -m 'Automatic integration of latest modpack.' && exit 0"
sshagent(['108c5045-64d1-42a6-acd7-a39da5e096d1']) {
sh "git pull -X theirs origin develop"
sh "git push --set-upstream origin origin/develop"
}
}
}
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'"
}
}
}
}
}