Merge branch 'master' of moriya.zapto.org:PDBA/bot-base
All checks were successful
Gitsokyo/bot-base/pipeline/head This commit looks good
All checks were successful
Gitsokyo/bot-base/pipeline/head This commit looks good
This commit is contained in:
commit
1a020b1fb1
1
.gitignore
vendored
1
.gitignore
vendored
@ -77,3 +77,4 @@ data/*
|
||||
/src/datas/
|
||||
/src/doctest_config.toml
|
||||
/datas
|
||||
requirements.txt
|
||||
|
1
.releaseignore
Normal file
1
.releaseignore
Normal file
@ -0,0 +1 @@
|
||||
pytest.ini
|
@ -2,7 +2,8 @@ FROM python:3.8
|
||||
|
||||
RUN apt-get update && apt-get install -y\
|
||||
rsync \
|
||||
openssh-client
|
||||
openssh-client \
|
||||
zip
|
||||
|
||||
RUN pip install pipenv
|
||||
|
||||
|
77
Jenkinsfile
vendored
77
Jenkinsfile
vendored
@ -7,10 +7,32 @@ pipeline {
|
||||
environment {
|
||||
SPHINXOPTS = '-w sphinx-build.log'
|
||||
DEPLOY_HOST = 'docs@moriya.zapto.org'
|
||||
DEPLOY_PATH = 'www/docs/bot-base/'
|
||||
PROJECT_NAME = 'bot-base'
|
||||
DEPLOY_DOC_PATH = "www/docs/${env.PROJECT_NAME}/"
|
||||
DEPLOY_REL_PATH = "www/releases/${env.PROJECT_NAME}/"
|
||||
RELEASE_ROOT = "src"
|
||||
TAG_NAME = """${TAG_NAME ?: ""}"""
|
||||
ARTIFACTS = "${WORKSPACE}/.artifacts"
|
||||
}
|
||||
stages {
|
||||
stage('Generate release archives') {
|
||||
steps {
|
||||
sh 'git clean -fxd'
|
||||
sh 'mkdir -p ${ARTIFACTS}/build'
|
||||
sh 'mkdir -p /tmp/build'
|
||||
sh 'pipenv lock -r | tee ${RELEASE_ROOT}/requirements.txt'
|
||||
sh 'echo .artifacts >> .releaseignore'
|
||||
sh 'rsync -avr --exclude-from=.releaseignore ${RELEASE_ROOT}/ /tmp/build'
|
||||
sh 'tar -C /tmp/build -cvzf ${ARTIFACTS}/build/${TAG_NAME:-${GIT_BRANCH#*/}}.tar.gz --owner=0 --group=0 .'
|
||||
sh 'cd /tmp/build && zip ${ARTIFACTS}/build/${TAG_NAME:-${GIT_BRANCH#*/}}.zip -r .'
|
||||
}
|
||||
post {
|
||||
always {
|
||||
archiveArtifacts artifacts: ".artifacts/build/*", fingerprint: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stages {
|
||||
stage('Install Dependencies') {
|
||||
steps {
|
||||
sh 'pipenv sync --verbose --sequential --dev'
|
||||
@ -31,14 +53,14 @@ pipeline {
|
||||
|
||||
stage('Build Documentation') {
|
||||
steps {
|
||||
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 .'
|
||||
sh 'mkdir -p ${ARTIFACTS}/doc'
|
||||
sh 'tar -C doc/build/html -czf ${ARTIFACTS}/doc/html.tar.gz .'
|
||||
}
|
||||
post {
|
||||
success {
|
||||
archiveArtifacts artifacts: "docs-${env.BUILD_TAG}.tar.gz", fingerprint: true
|
||||
archiveArtifacts artifacts: ".artifacts/doc/*", fingerprint: true
|
||||
}
|
||||
failure {
|
||||
sh 'cat doc/sphinx-build.log'
|
||||
@ -47,9 +69,6 @@ pipeline {
|
||||
}
|
||||
|
||||
stage('Deploy Documentation') {
|
||||
environment {
|
||||
TAG_NAME = """${TAG_NAME ?: ""}"""
|
||||
}
|
||||
when {
|
||||
anyOf {
|
||||
branch 'stable'
|
||||
@ -58,22 +77,52 @@ pipeline {
|
||||
}
|
||||
}
|
||||
steps {
|
||||
sh 'rm -f rsync.log'
|
||||
sshagent(credentials: ['1cf72f47-b70c-4f90-a958-020956099d19']) {
|
||||
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 'echo ${DEPLOY_HOST}:${DEPLOY_DOC_PATH}${TAG_NAME:-${GIT_BRANCH#*/}}/'
|
||||
sh 'ssh -o StrictHostKeyChecking=no -o BatchMode=yes ${DEPLOY_HOST} mkdir -p ${DEPLOY_DOC_PATH}${TAG_NAME:-${GIT_BRANCH#*/}}/'
|
||||
sh '''rsync -aze 'ssh -o StrictHostKeyChecking=no -o BatchMode=yes' \
|
||||
--log-file=rsync.log \
|
||||
--log-file=rsync-doc.log \
|
||||
--delete \
|
||||
doc/build/html/ ${DEPLOY_HOST}:${DEPLOY_PATH}${TAG_NAME:-${GIT_BRANCH#*/}}/'''
|
||||
doc/build/html/ ${DEPLOY_HOST}:${DEPLOY_DOC_PATH}${TAG_NAME:-${GIT_BRANCH#*/}}/'''
|
||||
}
|
||||
}
|
||||
post {
|
||||
failure {
|
||||
sh 'cat doc/debug.log doc/rsync.log'
|
||||
sh 'cat rsync-doc.log'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Deploy Release Files') {
|
||||
when {
|
||||
anyOf {
|
||||
branch 'stable'
|
||||
branch 'master'
|
||||
buildingTag()
|
||||
}
|
||||
}
|
||||
steps {
|
||||
sshagent(credentials: ['1cf72f47-b70c-4f90-a958-020956099d19']) {
|
||||
sh 'echo ${TAG_NAME:-${GIT_BRANCH#*/}}'
|
||||
sh 'echo ${DEPLOY_HOST}:${DEPLOY_REL_PATH}${TAG_NAME:-${GIT_BRANCH#*/}}/'
|
||||
sh 'ssh -o StrictHostKeyChecking=no -o BatchMode=yes ${DEPLOY_HOST} mkdir -p ${DEPLOY_REL_PATH}${TAG_NAME:-${GIT_BRANCH#*/}}/'
|
||||
sh '''rsync -aze 'ssh -o StrictHostKeyChecking=no -o BatchMode=yes' \
|
||||
--log-file=rsync-rel.log \
|
||||
--delete \
|
||||
${ARTIFACTS}/ ${DEPLOY_HOST}:${DEPLOY_REL_PATH}${TAG_NAME:-${GIT_BRANCH#*/}}/'''
|
||||
}
|
||||
}
|
||||
post {
|
||||
failure {
|
||||
sh 'cat rsync-rel.log'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
sh 'git clean -fxd'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user