rsemcs/Jenkinsfile

64 lines
3.9 KiB
Plaintext
Raw Permalink Normal View History

2022-01-08 20:23:08 +00:00
pipeline {
agent {
2022-05-17 17:31:07 +00:00
label 'increased_mem'
}
options {
disableConcurrentBuilds()
}
triggers {
cron("H H(0-7) * * *")
}
2022-01-08 20:23:08 +00:00
stages {
stage("notify") {
when {
branch "**/master"
triggeredBy 'TimerTrigger'
}
steps {
discordSend description: 'RS Jenkins has begun building the latest live (master branch) version of the server. This means the live Minecraft server **will shutdown** once the build has reached the deployment stage. Please be ready for this! For information on **what has changed**, **estimates of when reboot will occur** and **current progress**, checkout the build link.', footer: '', image: '', link: 'env.BUILD_URL', result: currentBuild.currentResult, scmWebUrl: '', thumbnail: '', title: 'RS Jenkins - ${env.JOB_NAME}: Build starting.', webhookURL: 'https://discord.com/api/webhooks/977367178884046919/LCJ_ngdNG1zo6Ak4CmzzUZbYD92LPUNn_mQO8IhwxoAVmswJo8p950qLFoQUck7LmIkf'
}
}
stage("run server") {
when {
not {
triggeredBy "BuildUpstreamCause"
}
}
2022-05-12 09:33:18 +00:00
steps {
fileOperations([fileCreateOperation(fileContent: 'eula=true', fileName: 'eula.txt')])
2022-05-30 21:54:19 +00:00
// fileOperations([fileDownloadOperation(password: '', proxyHost: '', proxyPort: '', targetFileName: 'DynmapBlockScan.jar', targetLocation: 'mods/', url: 'https://github.com/webbukkit/DynmapBlockScan/releases/download/v3.4-beta-1/DynmapBlockScan-3.4-beta-1-forge-1.18.jar', userName: '')])
2022-06-23 02:32:57 +00:00
pwsh returnStatus: true, script: 'echo "stop" | java -Xmx4G @libraries/net/minecraftforge/forge/1.18.2-40.1.52/unix_args.txt'
2022-05-12 09:33:18 +00:00
logParser failBuildOnError: true, projectRulePath: 'Jenkinsparse', parsingRulesPath: 'Jenkinsparse', showGraphs: true, unstableOnWarning: true, useProjectRule: true
2022-05-30 21:05:53 +00:00
fileOperations([fileDeleteOperation(excludes: '', includes: 'mods/DynmapBlockScan.jar')])
}
2022-05-12 09:33:18 +00:00
}
stage("deploy") {
when {
branch '**/master'
triggeredBy 'TimerTrigger'
}
steps {
2022-05-12 09:33:18 +00:00
sshagent(['ce4c701d-098c-4706-8f32-c0af996a7769']) {
discordSend description: 'The RSEMCS server will now be rebooting! Checkout the build link for shutdown progress (startup occurs after shutdown and usually takes 1-2 minutes).', footer: '', image: '', link: 'env.BUILD_URL', result: currentBuild.currentResult, scmWebUrl: '', thumbnail: '', title: 'RS Jenkins - ${env.JOB_NAME}: Server is rebooting!', webhookURL: 'https://discord.com/api/webhooks/977367178884046919/LCJ_ngdNG1zo6Ak4CmzzUZbYD92LPUNn_mQO8IhwxoAVmswJo8p950qLFoQUck7LmIkf'
pwsh "ssh -o StrictHostKeyChecking=no gamehost@entertainment 'systemctl --user stop rsemcs'"
pwsh "rsync -a --update --filter=':- .gitignore' --exclude=./mods/ --exclude='./config/' . gamehost@entertainment:/home/gamehost/mcserver/"
pwsh "rsync -a --update --filter=':- .gitignore' --delete ./mods/ gamehost@entertainment:/home/gamehost/mcserver/mods"
2022-06-20 03:25:34 +00:00
pwsh "rsync -a --update --filter=':- .gitignore' --delete ./mods/ gamehost@entertainment:/home/gamehost/mcserver/mods"
pwsh "rsync -a --filter=':- .gitignore' ./world/serverconfig/ gamehost@entertainment:/home/gamehost/mcserver/world/serverconfig"
pwsh "ssh gamehost@entertainment 'systemctl --user start rsemcs'"
}
}
}
stage("cleanup") {
when {
not {
triggeredBy "BuildUpstreamCause"
}
}
steps {
pwsh "git clean -dfX"
}
}
2022-01-08 20:23:08 +00:00
}
2022-05-12 09:33:18 +00:00
}