diff --git a/Jenkinsfile b/Jenkinsfile index 82cad6f..aeb8b4d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,7 +1,7 @@ pipeline { agent { dockerfile { - args '-u root -v $HOME/docker_volumes/.cache/:/root/.cache/' + args '-u root --net=host -v $HOME/docker_volumes/.cache/:/root/.cache/' } } environment { @@ -19,8 +19,7 @@ pipeline { stage('Run Tests') { steps { - sh '''export PYTHONPATH=$(pwd)/python - cd src + sh '''cd src pipenv run pytest -p no:warnings --junit-xml test-reports/results.xml''' } post { @@ -32,12 +31,15 @@ pipeline { stage('Build Documentation') { steps { - sh '''export PYTHONPATH=$(pwd)/python - cd doc - rm -f sphinx-build.log + sh 'rm -f doc/sphinx-build.log' + sh '''cd doc pipenv run make html''' + sh 'tar -C doc/build/html -czf docs-${BUILD_TAG}.tar.gz .' } post { + success { + archiveArtifacts artifacts: "docs-${env.BUILD_TAG}.tar.gz", fingerprint: true + } failure { sh 'cat doc/sphinx-build.log' } @@ -45,22 +47,26 @@ pipeline { } stage('Deploy Documentation') { + environment { + TAG_NAME = """${TAG_NAME ?: ""}""" + } when { anyOf { branch 'stable' branch 'master' + buildingTag() } } steps { + sh 'rm -f rsync.log' sshagent(credentials: ['1cf72f47-b70c-4f90-a958-020956099d19']) { - sh '''cd doc - rm -f rsync.log - echo ${DEPLOY_HOST}:${DEPLOY_PATH}${GIT_BRANCH#*/}/ >> debug.log - ssh -o StrictHostKeyChecking=no -o BatchMode=yes ${DEPLOY_HOST} mkdir -p ${DEPLOY_PATH}{GIT_BRANCH#*/}/ - rsync -aze 'ssh -o StrictHostKeyChecking=no -o BatchMode=yes' \ + 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' \ --log-file=rsync.log \ --delete \ - ./build/html/ ${DEPLOY_HOST}:${DEPLOY_PATH}${GIT_BRANCH#*/}/''' + doc/build/html/ ${DEPLOY_HOST}:${DEPLOY_PATH}${TAG_NAME:-${GIT_BRANCH#*/}}/''' } } post {