From 030ff6c64b0fb21a9447d4c2258f106425fb0449 Mon Sep 17 00:00:00 2001 From: Morgan McMillian Date: Fri, 10 Nov 2023 16:14:22 -0800 Subject: [PATCH] switch to jenkins --- Jenkinsfile | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..af541df --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,33 @@ +pipeline { + agent none + environment { + CHAT = "morgan@mcmillian.dev" + MAIL = "morgan@mcmillian.dev" + ANSIBLE_HOST_KEY_CHECKING = "False" + } + stages { + stage('Build website') { + steps { + sh 'git submodule update --init' + sh 'hugo' + } + } + stage('Execute playbook') { + agent { label 'ansible' } + steps { + ansiblePlaybook(playbook: "main.yaml", inventory: "hosts.ini", credentialsId: "igor") + } + post { + success { + jabberNotify buildToChatNotifier: [$class: 'ExtraMessageOnlyBuildToChatNotifier'], extraMessage: 'Deploy Succeeded', notifySuspects: true, targets: "${CHAT}" + } + failure { + jabberNotify buildToChatNotifier: [$class: 'ExtraMessageOnlyBuildToChatNotifier'], extraMessage: 'Deploy Failed', notifySuspects: true, targets: "${CHAT}" + mail to: "${MAIL}", + subject: "Deploy Failed: ${currentBuild.fullDisplayName}", + body: "Something is wrong with ${env.BUILD_URL}" + } + } + } + } +}