ESBO-ETC/Jenkinsfile
LukasK13 5c2f46e84d
All checks were successful
esbo_ds/ESBO-ETC/pipeline/head This commit looks good
Don't run docker container with root privileges
2020-07-22 08:09:51 +02:00

72 lines
2.1 KiB
Groovy

pipeline {
agent none
environment {
TEST_DIR = 'tests'
SPHINX_DIR = 'docs'
BUILD_DIR = 'build/html'
SOURCE_DIR = 'source'
}
stages {
stage('Test') {
agent {
dockerfile {
filename "Dockerfile"
args "-u root" //needed to get around permission issues
}
}
steps {
// Install dependencies
sh '''
virtualenv pyenv
. pyenv/bin/activate
pip3 install -r requirements.txt
'''
sh '''
export PYTHONPATH=`pwd`
pyenv/bin/python3 -m unittest discover test
'''
}
}
stage('Build Docs') {
agent {
dockerfile {
filename "Dockerfile"
args "-u root" //needed to get around permission issues
}
}
steps {
// Install dependencies
sh '''
virtualenv pyenv
. pyenv/bin/activate
pip3 install -r requirements.txt
'''
// clear out old files
sh 'rm -rf ${BUILD_DIR}'
sh 'rm -f ${SPHINX_DIR}/sphinx-build.log'
sh '''
pyenv/bin/sphinx-build \
-w ${SPHINX_DIR}/sphinx-build.log \
-b html ${SPHINX_DIR}/${SOURCE_DIR} ${SPHINX_DIR}/${BUILD_DIR}
'''
stash includes: 'docs/build/html/**/*.*', name: 'html'
}
post {
failure {
sh 'cat ${SPHINX_DIR}/sphinx-build.log'
}
}
}
stage('Deploy') {
agent {
label 'lunjaserv'
}
steps {
unstash 'html'
sh 'rm -rf /opt/esbo-etc/html/*'
sh 'cp -rf docs/build/html /opt/esbo-etc/'
}
}
}
}