update Jenkinsfile for unit testing (#61045)
This commit is contained in:
parent
48c545bbee
commit
592ffefc85
|
@ -2,14 +2,36 @@
|
||||||
|
|
||||||
pipeline {
|
pipeline {
|
||||||
agent any
|
agent any
|
||||||
|
options { disableConcurrentBuilds() }
|
||||||
|
environment {
|
||||||
|
TMPDIR = "/tmp/$BUILD_TAG"
|
||||||
|
}
|
||||||
stages {
|
stages {
|
||||||
|
stage('Unit Tests') {
|
||||||
|
steps {
|
||||||
|
sh "mkdir ${env.TMPDIR}"
|
||||||
|
sh """
|
||||||
|
python3 -m venv ${env.TMPDIR}/venv/
|
||||||
|
${env.TMPDIR}/venv/bin/pip install tox
|
||||||
|
PGPORT=`python3 -c 'import struct; import socket; s=socket.socket(); s.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER, struct.pack("ii", 1, 0)); s.bind(("", 0)); print(s.getsockname()[1]); s.close()'` pg_virtualenv -o fsync=off ${env.TMPDIR}/venv/bin/tox -r"""
|
||||||
|
}
|
||||||
|
post {
|
||||||
|
always {
|
||||||
|
script {
|
||||||
|
utils = new Utils()
|
||||||
|
utils.publish_coverage('coverage.xml')
|
||||||
|
utils.publish_coverage_native('index.html')
|
||||||
|
utils.publish_pylint('pylint.out')
|
||||||
|
}
|
||||||
|
mergeJunitResults()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
stage('Packaging') {
|
stage('Packaging') {
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
if (env.JOB_NAME == 'authentic2-auth-fedict' && env.GIT_BRANCH == 'origin/main') {
|
if (env.JOB_NAME == 'authentic2-auth-fedict' && env.GIT_BRANCH == 'origin/main') {
|
||||||
sh 'sudo -H -u eobuilder /usr/local/bin/eobuilder -d buster,bullseye authentic2-auth-fedict'
|
sh 'sudo -H -u eobuilder /usr/local/bin/eobuilder -d buster,bullseye authentic2-auth-fedict'
|
||||||
} else if (env.GIT_BRANCH.startsWith('hotfix/')) {
|
|
||||||
sh "sudo -H -u eobuilder /usr/local/bin/eobuilder -d buster,bullseye --branch ${env.GIT_BRANCH} --hotfix authentic2-auth-fedict"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +44,8 @@ pipeline {
|
||||||
utils.mail_notify(currentBuild, env, 'ci+jenkins-authentic2-auth-fedict@entrouvert.org')
|
utils.mail_notify(currentBuild, env, 'ci+jenkins-authentic2-auth-fedict@entrouvert.org')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
success {
|
cleanup {
|
||||||
|
sh "find ${env.TMPDIR} -type f -delete; rm -rf ${env.TMPDIR}"
|
||||||
cleanWs()
|
cleanWs()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue