-
Notifications
You must be signed in to change notification settings - Fork 2
/
Jenkinsfile
382 lines (373 loc) · 18.3 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
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
pipeline {
agent {
node {
label 'carbonio-agent-v1'
}
}
environment {
JAVA_OPTS = '-Dfile.encoding=UTF8'
LC_ALL = 'C.UTF-8'
jenkins_build = 'true'
}
parameters {
booleanParam defaultValue: false, description: 'Whether to upload the packages in playground repositories', name: 'PLAYGROUND'
}
options {
buildDiscarder(logRotator(numToKeepStr: '25'))
timeout(time: 2, unit: 'HOURS')
skipDefaultCheckout()
}
stages {
stage('Checkout') {
steps {
checkout scm
script {
env.GIT_COMMIT = sh(script: 'git rev-parse HEAD', returnStdout: true).trim()
}
}
}
stage('Build deb/rpm') {
stages {
stage('Stash') {
steps {
sh 'cp conf/nginx/errors/* package/proxy'
sh 'cp conf/nginx/templates/* package/proxy'
stash includes: '**', name: 'staging'
}
}
stage('yap') {
parallel {
stage('Ubuntu 20') {
agent {
node {
label 'yap-agent-ubuntu-20.04-v2'
}
}
steps {
unstash 'staging'
script {
if (BRANCH_NAME == 'devel') {
def timestamp = new Date().format('yyyyMMddHHmmss')
sh "yap build ubuntu-focal package -r ${timestamp} -s"
} else {
sh 'yap build ubuntu-focal package -s'
}
}
stash includes: 'artifacts/*focal*.deb', name: 'artifacts-ubuntu-focal'
}
post {
always {
archiveArtifacts artifacts: 'artifacts/*focal*.deb', fingerprint: true
}
}
}
stage('Ubuntu 22') {
agent {
node {
label 'yap-agent-ubuntu-22.04-v2'
}
}
steps {
unstash 'staging'
script {
if (BRANCH_NAME == 'devel') {
def timestamp = new Date().format('yyyyMMddHHmmss')
sh "yap build ubuntu-jammy package -r ${timestamp} -s"
} else {
sh 'yap build ubuntu-jammy package -s'
}
}
stash includes: 'artifacts/*jammy*.deb', name: 'artifacts-ubuntu-jammy'
}
post {
always {
archiveArtifacts artifacts: 'artifacts/*jammy*.deb', fingerprint: true
}
}
}
stage('Ubuntu 24') {
agent {
node {
label 'yap-agent-ubuntu-24.04-v2'
}
}
steps {
unstash 'staging'
script {
if (BRANCH_NAME == 'devel') {
def timestamp = new Date().format('yyyyMMddHHmmss')
sh "yap build ubuntu-noble package -r ${timestamp} -s"
} else {
sh 'yap build ubuntu-noble package -s'
}
}
stash includes: 'artifacts/*noble*.deb', name: 'artifacts-ubuntu-noble'
}
post {
always {
archiveArtifacts artifacts: 'artifacts/*noble*.deb', fingerprint: true
}
}
}
stage('RHEL8') {
agent {
node {
label 'yap-agent-rocky-8-v2'
}
}
steps {
unstash 'staging'
script {
if (BRANCH_NAME == 'devel') {
def timestamp = new Date().format('yyyyMMddHHmmss')
sh "yap build rocky-8 package -r ${timestamp} -s"
} else {
sh 'yap build rocky-8 package -s'
}
}
stash includes: 'artifacts/x86_64/*el8*.rpm', name: 'artifacts-rhel8'
}
post {
always {
archiveArtifacts artifacts: 'artifacts/x86_64/*el8*.rpm', fingerprint: true
}
}
}
stage('RHEL9') {
agent {
node {
label 'yap-agent-rocky-9-v2'
}
}
steps {
unstash 'staging'
script {
if (BRANCH_NAME == 'devel') {
def timestamp = new Date().format('yyyyMMddHHmmss')
sh "yap build rocky-9 package -r ${timestamp} -s"
} else {
sh 'yap build rocky-9 package -s'
}
}
stash includes: 'artifacts/x86_64/*el9*.rpm', name: 'artifacts-rhel9'
}
post {
always {
archiveArtifacts artifacts: 'artifacts/x86_64/*el9*.rpm', fingerprint: true
}
}
}
}
}
}
}
stage('Upload To Devel') {
when {
branch 'devel'
}
steps {
unstash 'artifacts-ubuntu-focal'
unstash 'artifacts-ubuntu-jammy'
unstash 'artifacts-ubuntu-noble'
unstash 'artifacts-rhel8'
unstash 'artifacts-rhel9'
script {
def server = Artifactory.server 'zextras-artifactory'
def buildInfo
def uploadSpec
buildInfo = Artifactory.newBuildInfo()
uploadSpec = """{
"files": [
{
"pattern": "artifacts/*focal*.deb",
"target": "ubuntu-devel/pool/",
"props": "deb.distribution=focal;deb.component=main;deb.architecture=amd64;vcs.revision=${env.GIT_COMMIT}"
},
{
"pattern": "artifacts/*jammy*.deb",
"target": "ubuntu-devel/pool/",
"props": "deb.distribution=jammy;deb.component=main;deb.architecture=amd64;vcs.revision=${env.GIT_COMMIT}"
},
{
"pattern": "artifacts/*noble*.deb",
"target": "ubuntu-devel/pool/",
"props": "deb.distribution=noble;deb.component=main;deb.architecture=amd64;vcs.revision=${env.GIT_COMMIT}"
},
{
"pattern": "artifacts/x86_64/(carbonio-proxy)-(*).el8.x86_64.rpm",
"target": "centos8-devel/zextras/{1}/{1}-{2}.el8.x86_64.rpm",
"props": "rpm.metadata.arch=x86_64;rpm.metadata.vendor=zextras;vcs.revision=${env.GIT_COMMIT}"
},
{
"pattern": "artifacts/x86_64/(carbonio-proxy)-(*).el9.x86_64.rpm",
"target": "rhel9-devel/zextras/{1}/{1}-{2}.el9.x86_64.rpm",
"props": "rpm.metadata.arch=x86_64;rpm.metadata.vendor=zextras;vcs.revision=${env.GIT_COMMIT}"
}
]
}"""
server.upload spec: uploadSpec, buildInfo: buildInfo, failNoOp: false
}
}
}
stage('Upload To Playground') {
when {
anyOf {
branch 'playground/*'
expression { params.PLAYGROUND == true }
}
}
steps {
unstash 'artifacts-ubuntu-focal'
unstash 'artifacts-ubuntu-jammy'
unstash 'artifacts-ubuntu-noble'
unstash 'artifacts-rhel8'
unstash 'artifacts-rhel9'
script {
def server = Artifactory.server 'zextras-artifactory'
def buildInfo
def uploadSpec
buildInfo = Artifactory.newBuildInfo()
uploadSpec = """{
"files": [
{
"pattern": "artifacts/*focal*.deb",
"target": "ubuntu-playground/pool/",
"props": "deb.distribution=focal;deb.component=main;deb.architecture=amd64;vcs.revision=${env.GIT_COMMIT}"
},
{
"pattern": "artifacts/*jammy*.deb",
"target": "ubuntu-playground/pool/",
"props": "deb.distribution=jammy;deb.component=main;deb.architecture=amd64;vcs.revision=${env.GIT_COMMIT}"
},
{
"pattern": "artifacts/*noble*.deb",
"target": "ubuntu-playground/pool/",
"props": "deb.distribution=noble;deb.component=main;deb.architecture=amd64;vcs.revision=${env.GIT_COMMIT}"
},
{
"pattern": "artifacts/(carbonio-proxy)-(*).el8.x86_64.rpm",
"target": "centos8-playground/zextras/{1}/{1}-{2}.el8.x86_64.rpm",
"props": "rpm.metadata.arch=x86_64;rpm.metadata.vendor=zextras;vcs.revision=${env.GIT_COMMIT}"
},
{
"pattern": "artifacts/x86_64/(carbonio-proxy)-(*).el9.x86_64.rpm",
"target": "rhel9-playground/zextras/{1}/{1}-{2}.el9.x86_64.rpm",
"props": "rpm.metadata.arch=x86_64;rpm.metadata.vendor=zextras;vcs.revision=${env.GIT_COMMIT}"
}
]
}"""
server.upload spec: uploadSpec, buildInfo: buildInfo, failNoOp: false
}
}
}
stage('Upload & Promotion Config') {
when {
anyOf {
branch 'release/*'
buildingTag()
}
}
steps {
unstash 'artifacts-ubuntu-focal'
unstash 'artifacts-ubuntu-jammy'
unstash 'artifacts-ubuntu-noble'
unstash 'artifacts-rhel8'
unstash 'artifacts-rhel9'
script {
def server = Artifactory.server 'zextras-artifactory'
def buildInfo
def uploadSpec
def config
// ubuntu
buildInfo = Artifactory.newBuildInfo()
buildInfo.name += '-ubuntu'
uploadSpec= """{
"files": [
{
"pattern": "artifacts/*focal*.deb",
"target": "ubuntu-rc/pool/",
"props": "deb.distribution=focal;deb.component=main;deb.architecture=amd64;vcs.revision=${env.GIT_COMMIT}"
},
{
"pattern": "artifacts/*jammy*.deb",
"target": "ubuntu-rc/pool/",
"props": "deb.distribution=jammy;deb.component=main;deb.architecture=amd64;vcs.revision=${env.GIT_COMMIT}"
},
{
"pattern": "artifacts/*noble*.deb",
"target": "ubuntu-rc/pool/",
"props": "deb.distribution=noble;deb.component=main;deb.architecture=amd64;vcs.revision=${env.GIT_COMMIT}"
}
]
}"""
server.upload spec: uploadSpec, buildInfo: buildInfo, failNoOp: false
config = [
'buildName' : buildInfo.name,
'buildNumber' : buildInfo.number,
'sourceRepo' : 'ubuntu-rc',
'targetRepo' : 'ubuntu-release',
'comment' : 'Do not change anything! Just press the button',
'status' : 'Released',
'includeDependencies': false,
'copy' : true,
'failFast' : true
]
Artifactory.addInteractivePromotion server: server, promotionConfig: config, displayName: 'Ubuntu Promotion to Release'
server.publishBuildInfo buildInfo
// rocky8
buildInfo = Artifactory.newBuildInfo()
buildInfo.name += '-centos8'
uploadSpec= """{
"files": [
{
"pattern": "artifacts/x86_64/(carbonio-proxy)-(*).el8.x86_64.rpm",
"target": "centos8-rc/zextras/{1}/{1}-{2}.el8.x86_64.rpm",
"props": "rpm.metadata.arch=x86_64;rpm.metadata.vendor=zextras;vcs.revision=${env.GIT_COMMIT}"
}
]
}"""
server.upload spec: uploadSpec, buildInfo: buildInfo, failNoOp: false
config = [
'buildName' : buildInfo.name,
'buildNumber' : buildInfo.number,
'sourceRepo' : 'centos8-rc',
'targetRepo' : 'centos8-release',
'comment' : 'Do not change anything! Just press the button',
'status' : 'Released',
'includeDependencies': false,
'copy' : true,
'failFast' : true
]
Artifactory.addInteractivePromotion server: server, promotionConfig: config, displayName: 'Centos8 Promotion to Release'
server.publishBuildInfo buildInfo
// rocky9
buildInfo = Artifactory.newBuildInfo()
buildInfo.name += '-rhel9'
uploadSpec= """{
"files": [
{
"pattern": "artifacts/x86_64/(carbonio-proxy)-(*).el9.x86_64.rpm",
"target": "rhel9-rc/zextras/{1}/{1}-{2}.el9.x86_64.rpm",
"props": "rpm.metadata.arch=x86_64;rpm.metadata.vendor=zextras;vcs.revision=${env.GIT_COMMIT}"
}
]
}"""
server.upload spec: uploadSpec, buildInfo: buildInfo, failNoOp: false
config = [
'buildName' : buildInfo.name,
'buildNumber' : buildInfo.number,
'sourceRepo' : 'rhel9-rc',
'targetRepo' : 'rhel9-release',
'comment' : 'Do not change anything! Just press the button',
'status' : 'Released',
'includeDependencies': false,
'copy' : true,
'failFast' : true
]
Artifactory.addInteractivePromotion server: server, promotionConfig: config, displayName: 'RHEL9 Promotion to Release'
server.publishBuildInfo buildInfo
}
}
}
}
}