-
Notifications
You must be signed in to change notification settings - Fork 4
/
Jenkinsfile
117 lines (96 loc) · 2.51 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
timeout(time: 6, unit: 'HOURS') {
node {
properties(
[
[
$class: 'BuildDiscarderProperty',
strategy: [$class: 'LogRotator', numToKeepStr: '10']
],
pipelineTriggers([cron('45 23 * * *')]),
]
)
try {
stage ('Prepare Workspace') {
checkout scm
sh '''
cat Jenkinsfile
'''
}
stage ('Regression Test Samples') {
sh '''
echo "Regression Test Samples"
cd samples
./executeSamples.sh
cd ..
'''
}
stage ('Review Vagrant Settings') {
sh '''
cat Vagrantfile
vagrant box list
if [ -d ./.vagrant ]; then
vagrant destroy -f
fi
'''
}
stage ('Test the CDAF sample on Ubuntu 18.04 LTS') {
sh '''
echo "Test the CDAF sample on Ubuntu 18.04 LTS"
export OVERRIDE_IMAGE="cdaf/Ubuntu18"
vagrant up
'''
}
stage ('Test the CDAF sample on Ubuntu 20.04 LTS') {
sh '''
echo "Test the CDAF sample on Ubuntu 20.04 LTS"
vagrant destroy -f
export OVERRIDE_IMAGE="cdaf/Ubuntu20"
vagrant up
'''
}
stage ('Test the CDAF sample on Ubuntu 22.04 LTS') {
sh '''
echo "Test the CDAF sample on Ubuntu 22.04 LTS"
vagrant destroy -f
export OVERRIDE_IMAGE="cdaf/Ubuntu22"
vagrant up
'''
}
stage ('Test the CDAF sample on Ubuntu Latest') {
sh '''
echo "Test the CDAF sample on Ubuntu Latest"
vagrant destroy -f
export OVERRIDE_IMAGE="cdaf/UbuntuLVM"
vagrant up
'''
}
} catch (e) {
currentBuild.result = "FAILED"
println currentBuild.result
notifyFailed()
throw e
} finally {
stage ('Destroy VMs and Discard sample vagrantfile') {
sh '''
if [ -d ./.vagrant ]; then
vagrant destroy -f
fi
'''
}
}
}
}
def notifyFailed() {
emailext (
recipientProviders: [[$class: 'DevelopersRecipientProvider']],
subject: "Linux FAILURE [${env.JOB_NAME}] Build [${env.BUILD_NUMBER}]",
body: "Check console output at ${env.BUILD_URL}"
)
if (env.DEFAULT_NOTIFICATION) {
emailext (
to: "${env.DEFAULT_NOTIFICATION}",
subject: "Linux FAILURE [${env.JOB_NAME}] Build [${env.BUILD_NUMBER}]",
body: "Check console output at ${env.BUILD_URL}"
)
}
}