-
Notifications
You must be signed in to change notification settings - Fork 13
/
Jenkinsfile
242 lines (241 loc) · 7.87 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
pipeline {
agent any
stages {
stage('Build') {
parallel {
stage('Service Lifecycle Manager') {
steps {
echo 'Building Service Lifecycle Manager container'
sh './pipeline/build/servicelifecyclemanagement.sh'
}
}
stage('Function Lifecycle Manager') {
steps {
echo 'Building Function Lifecycle Manager container'
sh './pipeline/build/functionlifecyclemanagement.sh'
}
}
stage('sonmanobase') {
steps {
echo 'Building sonmanobase container'
sh './pipeline/build/sonmanobase.sh'
}
}
stage('Specifc Manager Registry') {
steps {
echo 'Building Specific Manager Registry container'
sh './pipeline/build/specificmanagerregistry.sh'
}
}
stage('Placement Plugin') {
steps {
echo 'Building Placement Plugin container'
sh './pipeline/build/placementplugin.sh'
}
}
}
}
stage('Unittest Dependencies') {
steps {
sh './pipeline/unittest/create_dependencies.sh'
}
}
stage('Unittest Specifc Manager Registry') {
steps {
sh './pipeline/unittest/specificmanagerregistry_unittest.sh'
}
}
stage('Unittest second phase'){
parallel {
stage('Unittest Service Lifecycle Manager') {
steps {
sh './pipeline/unittest/servicelifecyclemanager_unittest.sh'
}
}
stage('Unittest Function Lifecycle Manager') {
steps {
sh './pipeline/unittest/functionlifecyclemanager_unittest.sh'
}
}
stage('Unittest sonmanobase') {
steps {
sh './pipeline/unittest/sonmanobase_unittest.sh'
}
}
stage('Unittest Placement Plugin') {
steps {
sh './pipeline/unittest/placementplugin_unittest.sh'
}
}
}
}
stage('Checkstyle') {
parallel {
stage('Service Lifecycle Manager') {
steps {
sh './pipeline/checkstyle/servicelifecyclemanager_stylecheck.sh || true'
}
}
stage('Function Lifecycle Manager') {
steps {
sh './pipeline/checkstyle/functionlifecyclemanager_stylecheck.sh || true'
}
}
stage('sonmanobase') {
steps {
sh './pipeline/checkstyle/sonmanobase_stylecheck.sh || true'
}
}
stage('Specifc Manager Registry') {
steps {
sh './pipeline/checkstyle/specificmanagerregistry_stylecheck.sh || true'
}
}
stage('Placement Plugin') {
steps {
sh './pipeline/checkstyle/placementplugin_stylecheck.sh || true'
}
}
}
}
stage('Publish to :latest') {
parallel {
stage('Service Lifecycle Manager') {
steps {
echo 'Publishing Service Lifecycle Manager container'
sh './pipeline/publish/servicelifecyclemanagement.sh latest'
}
}
stage('Function Lifecycle Manager') {
steps {
echo 'Publishing Function Lifecycle Manager container'
sh './pipeline/publish/functionlifecyclemanagement.sh latest'
}
}
stage('sonmanobase') {
steps {
echo 'Publishing sonmanobase container'
sh './pipeline/publish/sonmanobase.sh latest'
}
}
stage('Specifc Manager Registry') {
steps {
echo 'Publishing Specific Manager Registry container'
sh './pipeline/publish/specificmanagerregistry.sh latest'
}
}
stage('Placement Plugin') {
steps {
echo 'Publishing Placement Plugin container'
sh './pipeline/publish/placementplugin.sh latest'
}
}
}
}
stage('Deploying in pre-integration ') {
when{
not{
branch 'master'
}
}
steps {
sh 'rm -rf tng-devops || true'
sh 'git clone https://github.com/sonata-nfv/tng-devops.git'
dir(path: 'tng-devops') {
sh 'ansible-playbook roles/sp.yml -i environments -e "target=pre-int-sp component=mano-framework"'
}
}
}
stage('Publishing to :int') {
when{
branch 'master'
}
parallel {
stage('Service Lifecycle Manager') {
steps {
echo 'Publishing Service Lifecycle Manager container'
sh './pipeline/publish/servicelifecyclemanagement.sh int'
}
}
stage('Function Lifecycle Manager') {
steps {
echo 'Publishing Function Lifecycle Manager container'
sh './pipeline/publish/functionlifecyclemanagement.sh int'
}
}
stage('sonmanobase') {
steps {
echo 'Publishing sonmanobase container'
sh './pipeline/publish/sonmanobase.sh int'
}
}
stage('Specifc Manager Registry') {
steps {
echo 'Publishing Specific Manager Registry container'
sh './pipeline/publish/specificmanagerregistry.sh int'
}
}
stage('Placement Plugin') {
steps {
echo 'Publishing Placement Plugin container'
sh './pipeline/publish/placementplugin.sh int'
}
}
}
}
stage('Deploying in integration') {
when{
branch 'master'
}
steps {
sh './pipeline/publish/retag.sh'
sh 'rm -rf tng-devops || true'
sh 'git clone https://github.com/sonata-nfv/tng-devops.git'
dir(path: 'tng-devops') {
sh 'ansible-playbook roles/sp.yml -i environments -e "target=int-sp component=mano-framework"'
}
}
}
stage('Promoting release v5.1') {
when {
branch 'v5.1'
}
stages {
stage('Generating release') {
steps {
sh 'docker tag registry.sonata-nfv.eu:5000/servicelifecyclemanagement:latest registry.sonata-nfv.eu:5000/servicelifecyclemanagement:v5.1'
sh 'docker tag registry.sonata-nfv.eu:5000/functionlifecyclemanagement:latest registry.sonata-nfv.eu:5000/functionlifecyclemanagement:v5.1'
sh 'docker tag registry.sonata-nfv.eu:5000/specificmanagerregistry:latest registry.sonata-nfv.eu:5000/specificmanagerregistry:v5.1'
sh 'docker tag registry.sonata-nfv.eu:5000/placementplugin:latest registry.sonata-nfv.eu:5000/placementplugin:v5.1'
sh 'docker push registry.sonata-nfv.eu:5000/servicelifecyclemanagement:v5.1'
sh 'docker push registry.sonata-nfv.eu:5000/functionlifecyclemanagement:v5.1'
sh 'docker push registry.sonata-nfv.eu:5000/specificmanagerregistry:v5.1'
sh 'docker push registry.sonata-nfv.eu:5000/placementplugin:v5.1'
}
}
}
}
}
post {
always {
echo 'Clean Up'
sh './pipeline/cleanup/clean_environment.sh'
}
success {
emailext (
subject: "SUCCESS: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'",
body: """<p>SUCCESS: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]':</p>
<p>Check console output at "<a href='${env.BUILD_URL}'>${env.JOB_NAME} [${env.BUILD_NUMBER}]</a>"</p>""",
recipientProviders: [[$class: 'DevelopersRecipientProvider']]
)
}
failure {
emailext (
subject: "FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'",
body: """<p>FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]':</p>
<p>Check console output at "<a href='${env.BUILD_URL}'>${env.JOB_NAME} [${env.BUILD_NUMBER}]</a>"</p>""",
recipientProviders: [[$class: 'DevelopersRecipientProvider']]
)
}
}
}