Merge branch 'jenkins_tests'
All checks were successful
Gitsokyo/bot-base/pipeline/tag This commit looks good
Gitsokyo/bot-base/pipeline/head This commit looks good

This commit is contained in:
Suwako Moriya 2020-04-27 19:41:54 +02:00
commit 036c1ccfe4
Signed by: SuwakoMmh
GPG Key ID: A27482B806F13CD5

30
Jenkinsfile vendored
View File

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