2020-04-25 16:56:52 +02:00
|
|
|
pipeline {
|
2020-04-27 08:46:06 +02:00
|
|
|
agent {
|
|
|
|
dockerfile {
|
2020-04-27 19:41:07 +02:00
|
|
|
args '-u root --net=host -v $HOME/docker_volumes/.cache/:/root/.cache/'
|
2020-04-27 08:46:06 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
environment {
|
|
|
|
SPHINXOPTS = '-w sphinx-build.log'
|
|
|
|
DEPLOY_HOST = 'docs@moriya.zapto.org'
|
|
|
|
DEPLOY_PATH = 'www/docs/bot-base/'
|
|
|
|
}
|
|
|
|
|
2020-04-25 16:56:52 +02:00
|
|
|
stages {
|
2020-04-27 08:46:06 +02:00
|
|
|
stage('Install Dependencies') {
|
|
|
|
steps {
|
|
|
|
sh 'pipenv sync --verbose --sequential --dev'
|
2020-04-25 16:56:52 +02:00
|
|
|
}
|
2020-04-27 08:46:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
stage('Run Tests') {
|
2020-04-25 16:56:52 +02:00
|
|
|
steps {
|
2020-04-27 19:41:07 +02:00
|
|
|
sh '''cd src
|
2020-04-27 08:46:06 +02:00
|
|
|
pipenv run pytest -p no:warnings --junit-xml test-reports/results.xml'''
|
2020-04-25 16:56:52 +02:00
|
|
|
}
|
|
|
|
post {
|
|
|
|
always {
|
2020-04-26 00:01:34 +02:00
|
|
|
junit 'src/test-reports/results.xml'
|
2020-04-25 16:56:52 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-04-27 08:46:06 +02:00
|
|
|
|
|
|
|
stage('Build Documentation') {
|
|
|
|
steps {
|
2020-04-27 19:41:07 +02:00
|
|
|
sh 'rm -f doc/sphinx-build.log'
|
|
|
|
sh '''cd doc
|
2020-04-27 08:46:06 +02:00
|
|
|
pipenv run make html'''
|
2020-04-27 19:41:07 +02:00
|
|
|
sh 'tar -C doc/build/html -czf docs-${BUILD_TAG}.tar.gz .'
|
2020-04-27 08:46:06 +02:00
|
|
|
}
|
|
|
|
post {
|
2020-04-27 19:41:07 +02:00
|
|
|
success {
|
|
|
|
archiveArtifacts artifacts: "docs-${env.BUILD_TAG}.tar.gz", fingerprint: true
|
|
|
|
}
|
2020-04-27 08:46:06 +02:00
|
|
|
failure {
|
|
|
|
sh 'cat doc/sphinx-build.log'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
stage('Deploy Documentation') {
|
2020-04-27 19:41:07 +02:00
|
|
|
environment {
|
|
|
|
TAG_NAME = "${TAG_NAME}"
|
|
|
|
}
|
2020-04-27 08:46:06 +02:00
|
|
|
when {
|
|
|
|
anyOf {
|
|
|
|
branch 'stable'
|
|
|
|
branch 'master'
|
2020-04-27 19:41:07 +02:00
|
|
|
buildingTag()
|
2020-04-27 08:46:06 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
steps {
|
2020-04-27 19:41:07 +02:00
|
|
|
sh 'rm -f rsync.log'
|
2020-04-27 08:46:06 +02:00
|
|
|
sshagent(credentials: ['1cf72f47-b70c-4f90-a958-020956099d19']) {
|
2020-04-27 19:41:07 +02:00
|
|
|
sh 'echo ${TAG_NAME:-GIT_BRANCH#*/}'
|
|
|
|
sh 'echo ${DEPLOY_HOST}:${DEPLOY_PATH}${TAG_NAME:-GIT_BRANCH#*/}/ >> debug.log'
|
|
|
|
sh 'ssh -o StrictHostKeyChecking=no -o BatchMode=yes ${DEPLOY_HOST} mkdir -p ${DEPLOY_PATH}${TAG_NAME:-GIT_BRANCH#*/}/'
|
|
|
|
sh '''rsync -aze 'ssh -o StrictHostKeyChecking=no -o BatchMode=yes' \
|
2020-04-27 08:46:06 +02:00
|
|
|
--log-file=rsync.log \
|
|
|
|
--delete \
|
2020-04-27 19:41:07 +02:00
|
|
|
doc/build/html/ ${DEPLOY_HOST}:${DEPLOY_PATH}${TAG_NAME:-GIT_BRANCH#*/}/'''
|
2020-04-27 08:46:06 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
post {
|
|
|
|
failure {
|
|
|
|
sh 'cat doc/debug.log doc/rsync.log'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-04-25 16:56:52 +02:00
|
|
|
}
|
|
|
|
}
|