Projet

Général

Profil

0001-update-Jenkinsfile-for-unit-testing-61045.patch

Paul Marillonnet, 26 janvier 2022 11:16

Télécharger (2,35 ko)

Voir les différences:

Subject: [PATCH 1/3] update Jenkinsfile for unit testing (#61045)

 Jenkinsfile | 29 ++++++++++++++++++++++++++---
 1 file changed, 26 insertions(+), 3 deletions(-)
Jenkinsfile
2 2

  
3 3
pipeline {
4 4
    agent any
5
    options { disableConcurrentBuilds() }
6
    environment {
7
        TMPDIR = "/tmp/$BUILD_TAG"
8
    }
5 9
    stages {
10
        stage('Unit Tests') {
11
            steps {
12
                sh "mkdir ${env.TMPDIR}"
13
                sh """
14
python3 -m venv ${env.TMPDIR}/venv/
15
${env.TMPDIR}/venv/bin/pip install tox
16
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"""
17
            }
18
            post {
19
                always {
20
                    script {
21
                        utils = new Utils()
22
                        utils.publish_coverage('coverage.xml')
23
                        utils.publish_coverage_native('index.html')
24
                        utils.publish_pylint('pylint.out')
25
                    }
26
                    mergeJunitResults()
27
                }
28
            }
29
        }
6 30
        stage('Packaging') {
7 31
            steps {
8 32
                script {
9 33
                    if (env.JOB_NAME == 'authentic2-auth-fedict' && env.GIT_BRANCH == 'origin/main') {
10 34
                        sh 'sudo -H -u eobuilder /usr/local/bin/eobuilder -d buster,bullseye authentic2-auth-fedict'
11
                    } else if (env.GIT_BRANCH.startsWith('hotfix/')) {
12
                        sh "sudo -H -u eobuilder /usr/local/bin/eobuilder -d buster,bullseye --branch ${env.GIT_BRANCH} --hotfix authentic2-auth-fedict"
13 35
                    }
14 36
                }
15 37
            }
......
22 44
                utils.mail_notify(currentBuild, env, 'ci+jenkins-authentic2-auth-fedict@entrouvert.org')
23 45
            }
24 46
        }
25
        success {
47
        cleanup {
48
            sh "find ${env.TMPDIR} -type f -delete; rm -rf ${env.TMPDIR}"
26 49
            cleanWs()
27 50
        }
28 51
    }
29
-