2020-10-10 07:15:24 +02:00
|
|
|
pipeline {
|
2020-10-10 08:57:28 +02:00
|
|
|
agent none
|
2020-10-10 08:27:53 +02:00
|
|
|
|
2020-10-19 01:09:13 +02:00
|
|
|
triggers {
|
|
|
|
pollSCM('H 0-3,10-23 * * *')
|
|
|
|
}
|
|
|
|
|
2020-10-10 07:15:24 +02:00
|
|
|
stages {
|
|
|
|
stage('Build') {
|
2020-10-10 08:07:55 +02:00
|
|
|
parallel {
|
|
|
|
stage('HTML') {
|
|
|
|
agent {
|
|
|
|
docker {
|
2021-07-03 10:50:53 +02:00
|
|
|
image 'silex/emacs:27.2-alpine-ci-cask'
|
2020-10-10 08:07:55 +02:00
|
|
|
args '-u root --privileged'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
steps {
|
|
|
|
sh 'cask'
|
|
|
|
sh 'make html'
|
2020-10-10 08:57:49 +02:00
|
|
|
// Because we're running in root, the public/ directory
|
|
|
|
// isn't owned by the Jenkins user, meaning that
|
|
|
|
// unstashing in a different stage fails.
|
2021-07-03 10:44:47 +02:00
|
|
|
sh 'chown -R $(stat -c "%u" .):$(stat -c "%g" .) .cask .org-timestamps public'
|
2020-10-10 08:15:14 +02:00
|
|
|
stash includes: 'public/**', name: 'public_html'
|
2020-10-10 08:07:55 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
stage('CSS') {
|
|
|
|
agent { dockerfile true }
|
|
|
|
|
|
|
|
steps {
|
|
|
|
sh 'make css'
|
2020-10-10 08:15:14 +02:00
|
|
|
stash includes: 'public/**', name: 'public_css'
|
2020-10-10 08:07:55 +02:00
|
|
|
}
|
|
|
|
}
|
2020-10-10 07:20:16 +02:00
|
|
|
}
|
2020-09-21 10:44:42 +02:00
|
|
|
}
|
|
|
|
|
2020-10-10 07:15:24 +02:00
|
|
|
stage('Deploy') {
|
2020-10-10 08:07:55 +02:00
|
|
|
agent {
|
|
|
|
docker {
|
|
|
|
image 'instrumentisto/rsync-ssh'
|
2020-10-10 08:18:50 +02:00
|
|
|
args '-u root --privileged'
|
2020-10-10 08:07:55 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-10 07:20:16 +02:00
|
|
|
steps {
|
|
|
|
unstash 'public_html'
|
2020-10-10 08:07:55 +02:00
|
|
|
unstash 'public_css'
|
2020-09-21 10:44:42 +02:00
|
|
|
|
2020-10-10 10:37:03 +02:00
|
|
|
withCredentials([
|
|
|
|
sshUserPrivateKey(
|
|
|
|
credentialsId: 'ryuslash.org-deploy-key-2',
|
|
|
|
keyFileVariable: 'KEY_FILE',
|
|
|
|
usernameVariable: 'USERNAME'),
|
|
|
|
file(
|
|
|
|
credentialsId: 'ryuslash-known-hosts',
|
|
|
|
variable: 'KNOWN_HOSTS_FILE')
|
|
|
|
]) {
|
2020-10-18 23:13:42 +02:00
|
|
|
sh 'rsync -e "ssh -p 4511 -o \\"UserKnownHostsFile $KNOWN_HOSTS_FILE\\" -i $KEY_FILE" -v -c -r --delete public/ "$USERNAME@ryuslash.org:ryuslash-next/"'
|
2020-10-10 07:20:16 +02:00
|
|
|
}
|
2020-09-21 10:44:42 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|