Jenkinsfile will now only deploy on a timer.

The timer only triggers once every 24 hours.

Changed Discord notice configuration.
This commit is contained in:
Harrison Deng 2022-05-21 03:10:10 -05:00
parent f5269a9be4
commit 75bfb27c09

13
Jenkinsfile vendored
View File

@ -5,11 +5,17 @@ pipeline {
options { options {
disableConcurrentBuilds() disableConcurrentBuilds()
} }
triggers {
cron("H H(0-7) * * *")
}
stages { stages {
stage("install") { stage("notify") {
when {
branch "**/master"
}
steps { steps {
discordSend description: 'Hi everyone, this is just a friendly notice that RS Jenkins has begun building the latest (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: '', scmWebUrl: '', thumbnail: '', title: 'RS Jenkins - ${env.JOB_NAME}', webhookURL: 'https://discord.com/api/webhooks/977367178884046919/LCJ_ngdNG1zo6Ak4CmzzUZbYD92LPUNn_mQO8IhwxoAVmswJo8p950qLFoQUck7LmIkf' 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") { stage("run server") {
@ -29,10 +35,11 @@ pipeline {
stage("deploy") { stage("deploy") {
when { when {
branch '**/master' branch '**/master'
triggeredBy 'TimerTrigger'
} }
steps { steps {
sshagent(['ce4c701d-098c-4706-8f32-c0af996a7769']) { 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: '', scmWebUrl: '', thumbnail: '', title: 'RS Jenkins - ${env.JOB_NAME}: Server is rebooting!', webhookURL: 'https://discord.com/api/webhooks/977367178884046919/LCJ_ngdNG1zo6Ak4CmzzUZbYD92LPUNn_mQO8IhwxoAVmswJo8p950qLFoQUck7LmIkf' 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 "ssh -o StrictHostKeyChecking=no gamehost@entertainment 'systemctl --user stop rsemcs'"
pwsh "rsync -a --update --filter=':- .gitignore' --exclude=./mods/ --exclude='./config/' --exclude='./world' . gamehost@entertainment:/home/gamehost/mcserver/" pwsh "rsync -a --update --filter=':- .gitignore' --exclude=./mods/ --exclude='./config/' --exclude='./world' . gamehost@entertainment:/home/gamehost/mcserver/"
pwsh "rsync -a --update --filter=':- .gitignore' --delete ./mods/ gamehost@entertainment:/home/gamehost/mcserver/mods" pwsh "rsync -a --update --filter=':- .gitignore' --delete ./mods/ gamehost@entertainment:/home/gamehost/mcserver/mods"