1
|
@Library('eo-jenkins-lib@main') import eo.Utils
|
2
|
|
3
|
pipeline {
|
4
|
agent any
|
5
|
stages {
|
6
|
stage('Unit Tests') {
|
7
|
steps {
|
8
|
sh 'tox -r'
|
9
|
}
|
10
|
post {
|
11
|
always {
|
12
|
script {
|
13
|
utils = new Utils()
|
14
|
utils.publish_coverage('coverage.xml')
|
15
|
utils.publish_coverage_native('index.html')
|
16
|
utils.publish_pylint('pylint.out')
|
17
|
}
|
18
|
junit '*_results.xml'
|
19
|
}
|
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 ${SHORT_JOB_NAME}"
|
36
|
} else if (env.GIT_BRANCH.startsWith('hotfix/')) {
|
37
|
sh "sudo -H -u eobuilder /usr/local/bin/eobuilder --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-mandayejs@entrouvert.org')
|
48
|
}
|
49
|
}
|
50
|
success {
|
51
|
cleanWs()
|
52
|
}
|
53
|
}
|
54
|
}
|