Project

General

Profile

Download (1.83 KB) Statistics
| Branch: | Tag: | Revision:

root / Jenkinsfile @ main

1
@Library('eo-jenkins-lib@main') import eo.Utils
2

    
3
pipeline {
4
    agent any
5
    options { disableConcurrentBuilds() }
6
    stages {
7
        stage('Unit Tests') {
8
            steps {
9
                sh './jenkins.sh'
10
            }
11
            post {
12
                always {
13
                    script {
14
                        utils = new Utils()
15
                        utils.publish_coverage('coverage.xml')
16
                        utils.publish_coverage_native('index.html')
17
                        utils.publish_pylint('pylint.out')
18
                    }
19
                    junit '*_results.xml'
20
                }
21
            }
22
        }
23
        stage('Packaging') {
24
            steps {
25
                script {
26
                    env.SHORT_JOB_NAME=sh(
27
                        returnStdout: true,
28
                        // given JOB_NAME=gitea/project/PR-46, returns project
29
                        // given JOB_NAME=project/main, returns project
30
                        script: '''
31
                            echo "${JOB_NAME}" | sed "s/gitea\\///" | awk -F/ '{print $1}'
32
                        '''
33
                    ).trim()
34
                    if (env.GIT_BRANCH == 'main' || env.GIT_BRANCH == 'origin/main') {
35
                        sh "sudo -H -u eobuilder /usr/local/bin/eobuilder -d bullseye ${SHORT_JOB_NAME}"
36
                    } else if (env.GIT_BRANCH.startsWith('hotfix/')) {
37
                        sh "sudo -H -u eobuilder /usr/local/bin/eobuilder -d bullseye --branch ${env.GIT_BRANCH} --hotfix ${SHORT_JOB_NAME}"
38
                    }
39
                }
40
            }
41
        }
42
    }
43
    post {
44
        always {
45
            script {
46
                utils = new Utils()
47
                utils.mail_notify(currentBuild, env, 'ci+jenkins-auquotidien@entrouvert.org')
48
            }
49
        }
50
        success {
51
            cleanWs()
52
        }
53
    }
54
}
(4-4/9)