81 lines
3.5 KiB
Groovy
81 lines
3.5 KiB
Groovy
pipeline {
|
|
agent any
|
|
stages {
|
|
stage("update modpack") {
|
|
when {
|
|
allOf {
|
|
triggeredBy "BuildUpstreamCause"
|
|
branch '**/develop'
|
|
}
|
|
}
|
|
steps {
|
|
sshagent(['eb018bad-5d56-4306-a006-60fb7cf194aa']) {
|
|
sh "rm -rf update-folder"
|
|
sh "GIT_SSH_COMMAND='ssh -o StrictHostKeyChecking=no' git clone git@dev.sys.reslate.xyz:ydeng/rsemcs.git update-folder"
|
|
dir('update-folder') {
|
|
sh "git checkout develop"
|
|
sh "mkdir temp"
|
|
}
|
|
dir('update-folder/temp') {
|
|
sh "curl -LOJR https://dev.sys.reslate.xyz/dev-auto/job/ydeng-public/job/rsemcm/job/master/lastSuccessfulBuild/artifact/publish/RSEMCM_server.zip"
|
|
sh "unzip RSEMCM_server.zip"
|
|
}
|
|
dir('update-folder') {
|
|
sh "rm -rf ./mods"
|
|
sh "mv ./temp/mods ./"
|
|
sh "rsync -av --ignore-existing --delete ./temp/config ./config"
|
|
sh "rm -r ./temp"
|
|
sh "wget -i ../server_mods.txt -P ./mods/"
|
|
sh "rm -rf ./mods/*.jar.*"
|
|
sh "git add ."
|
|
sh returnStatus: true, script: 'git commit -a -m "Automatic updating of mods and their configurations."'
|
|
sh returnStatus: true, script: "git push"
|
|
}
|
|
sh "rm -rf update-folder"
|
|
}
|
|
}
|
|
}
|
|
stage("run server") {
|
|
when {
|
|
not {
|
|
triggeredBy "BuildUpstreamCause"
|
|
}
|
|
}
|
|
steps {
|
|
sh 'echo "eula=true" > eula.txt'
|
|
sh "chmod u+x ./run_trial.sh"
|
|
sh "curl -o mods/DynmapBlockScan.jar -LJR https://github.com/webbukkit/DynmapBlockScan/releases/download/v3.4-beta-1/DynmapBlockScan-3.4-beta-1-forge-1.18.jar"
|
|
lock('Port 25565') {
|
|
sh 'echo "stop" | ./run_trial.sh'
|
|
}
|
|
logParser failBuildOnError: true, projectRulePath: 'Jenkinsparse', parsingRulesPath: 'Jenkinsparse', showGraphs: true, unstableOnWarning: true, useProjectRule: true
|
|
sh "rm mods/DynmapBlockScan.jar"
|
|
}
|
|
}
|
|
stage("cleanup") {
|
|
when {
|
|
not {
|
|
triggeredBy "BuildUpstreamCause"
|
|
}
|
|
}
|
|
steps {
|
|
sh "git clean -dfX"
|
|
sh "rm -rf world"
|
|
}
|
|
}
|
|
stage("deploy") {
|
|
when {
|
|
branch '**/master'
|
|
}
|
|
steps {
|
|
sshagent(['ce4c701d-098c-4706-8f32-c0af996a7769']) {
|
|
sh "ssh -o StrictHostKeyChecking=no gamehost@entertainment 'systemctl --user stop rsemcs'"
|
|
sh "rsync -a --update --exclude ./mods/ --exclude ./config/ ./** gamehost@entertainment:/home/gamehost/mcserver/"
|
|
sh "rsync -a --update --delete ./mods/ gamehost@entertainment:/home/gamehost/mcserver/mods"
|
|
sh "rsync -a --update --delete ./config/ gamehost@entertainment:/home/gamehost/mcserver/config"
|
|
sh "ssh gamehost@entertainment 'systemctl --user start rsemcs'"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |