From 549aa8ee95fc180a7aef831a58852893f80c8a8b Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Sat, 8 Jun 2019 09:20:13 +0200 Subject: [PATCH] use new Jenksinfile (#33811) --- Jenkinsfile | 45 +++++++++++++++++++++++---------------------- tox.ini | 2 +- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 16dddc6..f6af064 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,30 +2,33 @@ pipeline { agent any - options { disableConcurrentBuilds() } + options { + disableConcurrentBuilds() + skipDefaultCheckout() + } environment { - TMPDIR = "/tmp/$BUILD_TAG" + TMPDIR = "$WORKSPACE" } stages { stage('Unit Tests') { steps { - sh "mkdir ${env.TMPDIR}" - sh """ -virtualenv -p python3 ${env.TMPDIR}/venv/ -. ${env.TMPDIR}/venv/bin/activate -${env.TMPDIR}/venv/bin/pip install tox -PGPORT=`python -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 -rv""" + cleanWs() + dir ("repository") { + checkout scm + tox() + } } post { always { - script { - utils = new Utils() - utils.publish_coverage('coverage.xml') - utils.publish_coverage_native('index.html') - utils.publish_pylint('pylint.out') + dir("repository") { + script { + utils = new Utils() + utils.publish_coverage('coverage.xml') + utils.publish_coverage_native('index.html') + utils.publish_pylint('pylint.out') + } + mergeJunitResults() } - sh './merge-junit-results.py junit-*.xml >junit.xml' - junit 'junit.xml' } } } @@ -41,14 +44,12 @@ PGPORT=`python -c 'import struct; import socket; s=socket.socket(); s.setsockopt } post { always { - script { - utils = new Utils() - utils.mail_notify(currentBuild, env, 'admin+jenkins-authentic2-auth-kerberos@entrouvert.com') + dir("repository") { + script { + utils = new Utils() + utils.mail_notify(currentBuild, env, 'admin+jenkins-authentic2-auth-kerberos@entrouvert.com') + } } } - success { - sh "rm -rf ${env.TMPDIR}" - cleanWs() - } } } diff --git a/tox.ini b/tox.ini index d2da311..bb360d1 100644 --- a/tox.ini +++ b/tox.ini @@ -5,7 +5,7 @@ [tox] -toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/authentic2-auth-kerberos/{env:BRANCH_NAME:} +toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/authentic2-auth-kerberos/ envlist = py27-coverage-{dj18,dj111}-{pg,sqlite}-{oldldap,},pylint [testenv]