2020-07-21 11:22:31 +02:00
|
|
|
pipeline {
|
|
|
|
agent {
|
|
|
|
dockerfile {
|
|
|
|
filename "Dockerfile"
|
|
|
|
args "-u root" //needed to get around permission issues
|
|
|
|
}
|
|
|
|
}
|
|
|
|
environment {
|
|
|
|
SPHINX_DIR = 'docs'
|
2020-07-21 13:41:21 +02:00
|
|
|
BUILD_DIR = 'build/html'
|
|
|
|
SOURCE_DIR = 'source'
|
2020-07-21 11:22:31 +02:00
|
|
|
DEPLOY_HOST = 'deployer@www.example.com:/path/to/docs/'
|
|
|
|
}
|
|
|
|
stages {
|
|
|
|
stage('Install Dependencies') {
|
|
|
|
steps {
|
|
|
|
// virtualenv may not be necessary with root,
|
|
|
|
// but I still think it's a good idea.
|
|
|
|
sh '''
|
|
|
|
virtualenv pyenv
|
|
|
|
. pyenv/bin/activate
|
2020-07-21 13:34:07 +02:00
|
|
|
pip3 install -r requirements.txt
|
2020-07-21 11:22:31 +02:00
|
|
|
'''
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Build') {
|
|
|
|
steps {
|
|
|
|
// clear out old files
|
|
|
|
sh 'rm -rf ${BUILD_DIR}'
|
|
|
|
sh 'rm -f ${SPHINX_DIR}/sphinx-build.log'
|
2020-07-21 13:45:40 +02:00
|
|
|
sh 'ls'
|
|
|
|
sh 'pyenv/bin/sphinx-build -b html docs/source docs/build/html'
|
|
|
|
/*
|
2020-07-21 11:22:31 +02:00
|
|
|
sh '''
|
|
|
|
${WORKSPACE}/pyenv/bin/sphinx-build \
|
|
|
|
-q -w ${SPHINX_DIR}/sphinx-build.log \
|
|
|
|
-b html \
|
2020-07-21 13:41:21 +02:00
|
|
|
-d ${SPHINX_DIR}/${BUILD_DIR}/doctrees ${SPHINX_DIR}/${SOURCE_DIR} ${SPHINX_DIR}/${BUILD_DIR}
|
2020-07-21 11:22:31 +02:00
|
|
|
'''
|
2020-07-21 13:45:40 +02:00
|
|
|
*/
|
2020-07-21 13:49:35 +02:00
|
|
|
archiveArtifacts 'docs/build/html/**/*.*'
|
2020-07-21 11:22:31 +02:00
|
|
|
}
|
|
|
|
post {
|
|
|
|
failure {
|
|
|
|
sh 'cat ${SPHINX_DIR}/sphinx-build.log'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
stage('Deploy') {
|
|
|
|
steps {
|
|
|
|
sshagent(credentials: ['deployer']) {
|
|
|
|
sh '''#!/bin/bash
|
|
|
|
rm -f ${SPHINX_DIR}/rsync.log
|
|
|
|
RSYNCOPT=(-aze 'ssh -o StrictHostKeyChecking=no')
|
|
|
|
rsync "${RSYNCOPT[@]}" \
|
|
|
|
--exclude-from=${SPHINX_DIR}/rsync-exclude.txt \
|
|
|
|
--log-file=${SPHINX_DIR}/rsync.log \
|
|
|
|
--delete \
|
|
|
|
${BUILD_DIR}/ ${DEPLOY_HOST}
|
|
|
|
'''
|
|
|
|
}
|
|
|
|
}
|
|
|
|
post {
|
|
|
|
failure {
|
|
|
|
sh 'cat ${SPHINX_DIR}/rsync.log'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
}
|