setup site deployment via jenkins
Some checks failed
dreamfall/morgan.mcmillian.dev/pipeline/head There was a failure building this commit

This commit is contained in:
Morgan McMillian 2023-02-09 17:36:29 -08:00
parent 048dd52e57
commit fbee2cfb8c
3 changed files with 55 additions and 0 deletions

42
Jenkinsfile vendored Normal file
View file

@ -0,0 +1,42 @@
pipeline {
agent {
docker {
image 'git.dreamfall.space/thrrgilag/kiln:latest'
label 'docker-build'
}
}
stages {
stage('Build site') {
steps {
mattermostSend "Site build started - ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL}|Open>)"
sh 'kiln build'
}
post {
success {
mattermostSend color: "good", message: "Site build success - ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL}|Open>)"
}
failure {
mattermostSend color: "danger", message: "Site build failure - ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL}|Open>)"
}
}
}
stage('Deploy site') {
steps {
mattermostSend "Site deploy started - ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL}|Open>)"
ansiblePlaybook(
playbook: 'main.yaml',
inventory: 'hosts.ini',
credentialsId: 'onedrop-vetinari'
)
}
post {
success {
mattermostSend color: "good", message: "Site deploy success - ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL}|Open>)"
}
failure {
mattermostSend color: "danger", message: "Site deploy failure - ${env.JOB_NAME} ${env.BUILD_NUMBER} (<${env.BUILD_URL}|Open>)"
}
}
}
}
}

2
hosts.ini Normal file
View file

@ -0,0 +1,2 @@
[web]
vetinari.dreamfall.space

11
main.yaml Normal file
View file

@ -0,0 +1,11 @@
---
- name: Deploy morgan.mcmillian.dev site
hosts: web
vars:
html_location: /var/www/html/morgan.mcmillian.dev
tasks:
- name: Sync html directory
ansible.posix.synchronize:
src: public/html/
dest: "{{ html_location }}/"