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 --strategy-option theirs 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 push" } sh "git checkout develop" } } stage("deploy") { when { branch '**/master' } steps { sh "git clean -dfX" sh "rm -r world" sshagent(['ce4c701d-098c-4706-8f32-c0af996a7769']) { sh "systemctl --user stop rsemcs" sh "scp -r ./** gamehost@entertainment:/home/gamehost/mcserver/" sh "systemctl --user start rsemcs" } } } } }