-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile.nightly
716 lines (670 loc) · 31.2 KB
/
Jenkinsfile.nightly
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
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
#!groovy
/**
* This program and the accompanying materials are made available under the terms of the
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v20.html
*
* SPDX-License-Identifier: EPL-2.0
*
* Copyright IBM Corporation 2018, 2019
*/
node('zowe-jenkins-agent-dind-wdc') {
def lib = library("jenkins-library").org.zowe.jenkins_shared_library
def SLACK_CHANNEL = '#zowe-build'
def ZOWE_RELEASE_REPOSITORY = 'libs-release-local'
def ZOWE_RELEASE_PATH = '/org/zowe/nightly'
def ZOWE_BUILD_NAME = 'zowe-install-packaging :: staging'
def ZOWE_BUILD_REPOSITORY = 'libs-snapshot-local'
def ZOWE_CLI_RELEASE_PATH = '/org/zowe/nightly/cli'
def ZOWE_CLI_BUILD_NAME = 'Zowe CLI Bundle :: master'
def ZOWE_CLI_BUILD_REPOSITORY = 'libs-snapshot-local'
def IS_BUILD_UNSTABLE = false
def isStagingBranch = env && env.BRANCH_NAME == 'staging'
def sourceRegBuildInfo
def sourceSmpeBuildInfo
def sourceDockerAmd64BuildInfo
def sourceContainerizationBuildInfo
def cliSourceBuildInfo
def cliPluginsSourceBuildInfo
def testRegBuildErrorUrl
def testSmpeBuildErrorUrl
def testDockerBuildErrorUrl
def testMultipleNodeErrorUrl
def testMultipleKeyringErrorUrl
def testExternalCertificates
def targetSmpeFullPath
def targetRegFullPath
def targetDockeramd64FullPath
def cliTargetFullPath
def cliPluginsTargetFullPath
def pipeline = lib.pipelines.generic.GenericPipeline.new(this)
pipeline.admins.add("jackjia", "markackert")
// we have extra parameters for the pipeline
pipeline.addBuildParameter(
booleanParam(
name: 'TEST_RUN',
description: 'Test run will skip test cases and will not send out Slack message.',
defaultValue: isStagingBranch ? false : true
)
)
// we want to run daily on master branch
// if (isStagingBranch) {
// pipeline.addBuildOption(pipelineTriggers([cron("TZ=America/New_York\nH 23 * * *")]))
// }
// get the day of the week
def currentDayofWeek = sh(script: 'date +"%a"', returnStdout: true).trim()
boolean fullTestRun = false
boolean keyringRun = false
// only run full test suite on Saturdays
if (currentDayofWeek.equals('Sat')) {
fullTestRun = true
}
if (currentDayofWeek.equals('Wed')) {
keyringRun = true
}
pipeline.setup(
packageName: 'org.zowe',
github: [
email : lib.Constants.DEFAULT_GITHUB_ROBOT_EMAIL,
usernamePasswordCredential : lib.Constants.DEFAULT_GITHUB_ROBOT_CREDENTIAL,
],
artifactory: [
url : lib.Constants.DEFAULT_LFJ_ARTIFACTORY_URL,
usernamePasswordCredential : lib.Constants.DEFAULT_LFJ_ARTIFACTORY_ROBOT_CREDENTIAL,
]
)
pipeline.createStage(
name : "Pre-Check",
isSkippable : true,
stage : {
echo "Checking last build of \"${ZOWE_BUILD_NAME}\" ..."
// check artifactory for latest build with SMP/E and docker amd64 image
try {
def smpeBuild = pipeline.artifactory.getArtifact([
'pattern' : "${ZOWE_BUILD_REPOSITORY}/*/zowe-smpe-*.zip",
'build-name' : ZOWE_BUILD_NAME
])
def dockerAmd64Build = pipeline.artifactory.getArtifact([
'pattern' : "${ZOWE_BUILD_REPOSITORY}/*/server-bundle.amd64-*.tar",
'build-name' : ZOWE_BUILD_NAME
])
def containerizationBuild = pipeline.artifactory.getArtifact([
'pattern' : "${ZOWE_BUILD_REPOSITORY}/*/zowe-containerization-*.zip",
'build-name' : ZOWE_BUILD_NAME
])
// extract build information
def buildNumber = smpeBuild['build.number']
def buildTimestamp = smpeBuild['build.timestamp']
long buildTimestampInt = buildTimestamp as Long
def currentTimestamp = sh(script: 'date +"%s"', returnStdout: true).trim()
long currentTimestampInt = currentTimestamp as Long
def timeElapse = (currentTimestampInt * 1000 - buildTimestampInt) / (3600 * 1000)
echo "Build #${buildNumber} is ${timeElapse} hours ago"
if (timeElapse < 12) { // how many hours we consider it's too old?
echo "Will skip re-build."
sourceSmpeBuildInfo = smpeBuild
sourceDockerAmd64BuildInfo = dockerAmd64Build
sourceContainerizationBuildInfo = containerizationBuild
} else {
echo "Will need to re-build."
}
} catch (es) {
echo "getArtifact zowe-smpe-*.zip, or server-bundle.amd64-*.tar, or zowe-containerization-*.zip failed: ${es}"
echo "Will need to re-build."
}
echo "Checking last CLI build of \"${ZOWE_CLI_BUILD_NAME}\" ..."
// check artifactory for latest CLI build
try {
cliSourceBuildInfo = pipeline.artifactory.getArtifact([
'pattern' : "${ZOWE_CLI_BUILD_REPOSITORY}/org/zowe/cli/zowe-cli-package/*/zowe-cli-package-1*.zip",
//'build-name' : ZOWE_CLI_BUILD_NAME // we no longer rely on jenkins to find artifacts
])
} catch (e) {
// CLI build missing, will not promote CLI
echo "Ignored: ${e}"
}
try {
cliPluginsSourceBuildInfo = pipeline.artifactory.getArtifact([
'pattern' : "${ZOWE_CLI_BUILD_REPOSITORY}/*/zowe-cli-plugins-1*.zip",
//'build-name' : ZOWE_CLI_BUILD_NAME // we no longer rely on jenkins to find artifacts
])
} catch (e) {
// CLI build missing, will not promote CLI
echo "Ignored: ${e}"
}
},
timeout: [time: 2, unit: 'MINUTES']
)
pipeline.build(
name : "Zowe",
timeout : [time: 1, unit: 'HOURS'],
isSkippable : false,
operation : {
if (!sourceSmpeBuildInfo || !sourceSmpeBuildInfo['path']) {
echo "Building new driver ..."
// run build
def build_result = build(
job: '/zowe-install-packaging/staging',
parameters: [
booleanParam(name: 'BUILD_SMPE', value: true),
booleanParam(name: 'BUILD_DOCKER', value: true),
booleanParam(name: 'BUILD_KUBERNETES', value: true),
booleanParam(name: 'Skip Stage: Test Convenience Build', value: true),
],
propagate: false
)
echo "Build result: ${build_result.result}"
if (build_result.result != 'SUCCESS') {
error "Failed to build a new Zowe driver, check failure details at ${build_result.absoluteUrl}"
}
// load build info
sourceSmpeBuildInfo = pipeline.artifactory.getArtifact([
'pattern' : "${ZOWE_BUILD_REPOSITORY}/*/zowe-smpe-*.zip",
'build-name' : ZOWE_BUILD_NAME
])
sourceDockerAmd64BuildInfo = pipeline.artifactory.getArtifact([
'pattern' : "${ZOWE_BUILD_REPOSITORY}/*/server-bundle.amd64-*.tar",
'build-name' : ZOWE_BUILD_NAME
])
sourceContainerizationBuildInfo = pipeline.artifactory.getArtifact([
'pattern' : "${ZOWE_BUILD_REPOSITORY}/*/zowe-containerization-*.zip",
'build-name' : ZOWE_BUILD_NAME
])
} else {
echo "No need to build new driver."
}
}
)
pipeline.createStage(
name : "Load Build Info",
isSkippable : true,
shouldExecute : {
return sourceSmpeBuildInfo && sourceSmpeBuildInfo['path']
},
stage : {
sourceRegBuildInfo = pipeline.artifactory.getArtifact([
'pattern' : "${ZOWE_BUILD_REPOSITORY}/*/zowe-*.pax",
'build-name' : ZOWE_BUILD_NAME,
'build-number' : sourceSmpeBuildInfo['build.number']
])
},
timeout: [time: 2, unit: 'MINUTES']
)
pipeline.test(
name : "Zowe docker Amd-64 image",
shouldExecute : {
return sourceDockerAmd64BuildInfo && sourceDockerAmd64BuildInfo['path'] && sourceRegBuildInfo && sourceRegBuildInfo['path']
},
operation : {
def docker_amd64_url = pipeline.artifactory.url + '/' + sourceDockerAmd64BuildInfo.path
if (params.TEST_RUN) {
echo "Skip testing with parameters:\n\n" +
"STARTED_BY_AUTOMATION: true\n" +
"TEST_SCOPE: test docker\n" +
"ZOWE_ARTIFACTORY_PATTERN: '${sourceRegBuildInfo.path}'\n" +
"ZOWE_CLI_PLUGINS_ARTIFACTORY_PATTERN: '${cliPluginsSourceBuildInfo ? cliPluginsSourceBuildInfo.path : ''}'\n" +
"ZOWE_ARTIFACTORY_BUILD: ''\n" +
"ZOWE_CLI_ARTIFACTORY_PATTERN: '${cliSourceBuildInfo ? cliSourceBuildInfo.path : ''}'\n" +
"ZOWE_CLI_ARTIFACTORY_BUILD: ''\n" +
"ZOWE_DOCKER_ARTIFACTORY_BUILD: '${docker_amd64_url}'\n" +
"INSTALL_TEST_DEBUG_INFORMATION: 'zowe-install-test:*'\n" +
"SANITY_TEST_DEBUG_INFORMATION: 'zowe-sanity-test:*'\n" +
"Skip Stage: Lint: true\n" +
"Skip Stage: Audit: true\n" +
"Skip Stage: SonarQube Scan: true"
} else {
def testParameters = [
booleanParam(name: 'STARTED_BY_AUTOMATION', value: true),
string(name: 'TEST_SERVER', value: 'marist-4'),
string(name: 'TEST_SCOPE', value: 'test docker'),
string(name: 'ZOWE_ARTIFACTORY_PATTERN', value: sourceRegBuildInfo.path),
string(name: 'ZOWE_ARTIFACTORY_BUILD', value: ''),
string(name: 'ZOWE_DOCKER_ARTIFACTORY_BUILD', value: docker_amd64_url),
string(name: 'CLIENT_NODE_VERSION', value: 'v12.18.3'),
string(name: 'INSTALL_TEST_DEBUG_INFORMATION', value: 'zowe-install-test:*'),
string(name: 'SANITY_TEST_DEBUG_INFORMATION', value: 'zowe-sanity-test:*'),
booleanParam(name: 'Skip Stage: Lint', value: true),
booleanParam(name: 'Skip Stage: Audit', value: true),
booleanParam(name: 'Skip Stage: SonarQube Scan', value: true)
]
if (cliSourceBuildInfo && cliSourceBuildInfo.path) {
testParameters.add(string(name: 'ZOWE_CLI_ARTIFACTORY_PATTERN', value: cliSourceBuildInfo.path))
testParameters.add(string(name: 'ZOWE_CLI_ARTIFACTORY_BUILD', value: ''))
}
// FIXME: add back after those 2 parameters are added to zowe-install-test
// if (cliPluginsSourceBuildInfo && cliPluginsSourceBuildInfo.path) {
// testParameters.add(string(name: 'ZOWE_CLI_PLUGINS_ARTIFACTORY_PATTERN', value: cliPluginsSourceBuildInfo.path))
// testParameters.add(string(name: 'ZOWE_CLI_ARTIFACTORY_BUILD', value: ''))
// }
def test_result = build(
job: '/zowe-install-test/staging',
parameters: testParameters,
propagate: false
)
echo "Test result: ${test_result.result}"
if (test_result.result != 'SUCCESS') {
testDockerBuildErrorUrl = test_result.absoluteUrl
echo "Test failed on Docker Image ${sourceDockerAmd64BuildInfo.url}, check failure details at ${test_result.absoluteUrl}"
IS_BUILD_UNSTABLE = true
}
}
},
allowMissingJunit : true,
timeout: [time: 4, unit: 'HOURS']
)
pipeline.test(
name : "Zowe Regular Build",
shouldExecute : {
return sourceRegBuildInfo && sourceRegBuildInfo['path']
},
operation : {
if (params.TEST_RUN) {
echo "Skip testing with parameters:\n\n" +
"STARTED_BY_AUTOMATION: true\n" +
"TEST_SCOPE: bundle: convenience build on multiple security systems\n" +
"ZOWE_ARTIFACTORY_PATTERN: '${sourceRegBuildInfo.path}'\n" +
"ZOWE_ARTIFACTORY_BUILD: ''\n" +
"ZOWE_CLI_ARTIFACTORY_PATTERN: '${cliSourceBuildInfo ? cliSourceBuildInfo.path : ''}'\n" +
"ZOWE_CLI_PLUGINS_ARTIFACTORY_PATTERN: '${cliPluginsSourceBuildInfo ? cliPluginsSourceBuildInfo.path : ''}'\n" +
"ZOWE_CLI_ARTIFACTORY_BUILD: ''\n" +
"INSTALL_TEST_DEBUG_INFORMATION: 'zowe-install-test:*'\n" +
"SANITY_TEST_DEBUG_INFORMATION: 'zowe-sanity-test:*'\n" +
"Skip Stage: Lint: true\n" +
"Skip Stage: Audit: true\n" +
"Skip Stage: SonarQube Scan: true"
} else {
def testParameters = [
booleanParam(name: 'STARTED_BY_AUTOMATION', value: true),
string(name: 'TEST_SCOPE', value: 'bundle: convenience build on multiple security systems'),
string(name: 'ZOWE_ARTIFACTORY_PATTERN', value: sourceRegBuildInfo.path),
string(name: 'ZOWE_ARTIFACTORY_BUILD', value: ''),
string(name: 'CLIENT_NODE_VERSION', value: 'v12.18.3'),
string(name: 'INSTALL_TEST_DEBUG_INFORMATION', value: 'zowe-install-test:*'),
string(name: 'SANITY_TEST_DEBUG_INFORMATION', value: 'zowe-sanity-test:*'),
booleanParam(name: 'Skip Stage: Lint', value: true),
booleanParam(name: 'Skip Stage: Audit', value: true),
booleanParam(name: 'Skip Stage: SonarQube Scan', value: true)
]
if (cliSourceBuildInfo && cliSourceBuildInfo.path) {
testParameters.add(string(name: 'ZOWE_CLI_ARTIFACTORY_PATTERN', value: cliSourceBuildInfo.path))
testParameters.add(string(name: 'ZOWE_CLI_ARTIFACTORY_BUILD', value: ''))
}
// FIXME: add back after those 2 parameters are added to zowe-install-test
// if (cliPluginsSourceBuildInfo && cliPluginsSourceBuildInfo.path) {
// testParameters.add(string(name: 'ZOWE_CLI_PLUGINS_ARTIFACTORY_PATTERN', value: cliPluginsSourceBuildInfo.path))
// testParameters.add(string(name: 'ZOWE_CLI_ARTIFACTORY_BUILD', value: ''))
// }
def test_result = build(
job: '/zowe-install-test/staging',
parameters: testParameters,
propagate: false
)
echo "Test result: ${test_result.result}"
if (test_result.result != 'SUCCESS') {
testRegBuildErrorUrl = test_result.absoluteUrl
echo "Test failed on regular build ${sourceRegBuildInfo.path}, check failure details at ${test_result.absoluteUrl}"
IS_BUILD_UNSTABLE = true
}
}
},
allowMissingJunit : true,
timeout: [time: 2, unit: 'HOURS']
)
pipeline.test(
name : "Zowe SMP/e Build",
shouldExecute : {
return sourceSmpeBuildInfo && sourceSmpeBuildInfo['path']
},
operation : {
if (params.TEST_RUN) {
echo "Skip testing with parameters:\n\n" +
"STARTED_BY_AUTOMATION: true\n" +
"TEST_SCOPE: bundle: smpe ptf on multiple security systems\n" +
"ZOWE_ARTIFACTORY_PATTERN: '${sourceSmpeBuildInfo.path}'\n" +
"ZOWE_CLI_PLUGINS_ARTIFACTORY_PATTERN: '${cliPluginsSourceBuildInfo ? cliPluginsSourceBuildInfo.path : ''}'\n" +
"ZOWE_ARTIFACTORY_BUILD: ''\n" +
"ZOWE_CLI_ARTIFACTORY_PATTERN: '${cliSourceBuildInfo ? cliSourceBuildInfo.path : ''}'\n" +
"ZOWE_CLI_ARTIFACTORY_BUILD: ''\n" +
"INSTALL_TEST_DEBUG_INFORMATION: 'zowe-install-test:*'\n" +
"SANITY_TEST_DEBUG_INFORMATION: 'zowe-sanity-test:*'\n" +
"Skip Stage: Lint: true\n" +
"Skip Stage: Audit: true\n" +
"Skip Stage: SonarQube Scan: true"
} else {
def testParameters = [
booleanParam(name: 'STARTED_BY_AUTOMATION', value: true),
string(name: 'TEST_SCOPE', value: 'bundle: smpe ptf on multiple security systems'),
string(name: 'ZOWE_ARTIFACTORY_PATTERN', value: sourceSmpeBuildInfo.path),
string(name: 'ZOWE_ARTIFACTORY_BUILD', value: ''),
string(name: 'CLIENT_NODE_VERSION', value: 'v12.18.3'),
string(name: 'INSTALL_TEST_DEBUG_INFORMATION', value: 'zowe-install-test:*'),
string(name: 'SANITY_TEST_DEBUG_INFORMATION', value: 'zowe-sanity-test:*'),
booleanParam(name: 'Skip Stage: Lint', value: true),
booleanParam(name: 'Skip Stage: Audit', value: true),
booleanParam(name: 'Skip Stage: SonarQube Scan', value: true)
]
if (cliSourceBuildInfo && cliSourceBuildInfo.path) {
testParameters.add(string(name: 'ZOWE_CLI_ARTIFACTORY_PATTERN', value: cliSourceBuildInfo.path))
testParameters.add(string(name: 'ZOWE_CLI_ARTIFACTORY_BUILD', value: ''))
}
// FIXME: add back after those 2 parameters are added to zowe-install-test
// if (cliPluginsSourceBuildInfo && cliPluginsSourceBuildInfo.path) {
// testParameters.add(string(name: 'ZOWE_CLI_PLUGINS_ARTIFACTORY_PATTERN', value: cliPluginsSourceBuildInfo.path))
// testParameters.add(string(name: 'ZOWE_CLI_ARTIFACTORY_BUILD', value: ''))
// }
def test_result = build(
job: '/zowe-install-test/staging',
parameters: testParameters,
propagate: false
)
echo "Test result: ${test_result.result}"
if (test_result.result != 'SUCCESS') {
testSmpeBuildErrorUrl = test_result.absoluteUrl
echo "Test failed on SMP/e build ${sourceSmpeBuildInfo.path}, check failure details at ${test_result.absoluteUrl}"
IS_BUILD_UNSTABLE = true
}
}
},
allowMissingJunit : true,
timeout: [time: 4, unit: 'HOURS']
)
pipeline.test(
name : "Zowe Multiple Node Versions Build",
shouldExecute : {
return fullTestRun && sourceRegBuildInfo && sourceRegBuildInfo['path']
},
operation : {
if (params.TEST_RUN) {
echo "Skip testing with parameters:\n\n" +
"STARTED_BY_AUTOMATION: true\n" +
"TEST_SCOPE: bundle: multiple node versions\n" +
"ZOWE_ARTIFACTORY_PATTERN: '${sourceRegBuildInfo.path}'\n" +
"ZOWE_ARTIFACTORY_BUILD: ''\n" +
"ZOWE_CLI_ARTIFACTORY_PATTERN: '${cliSourceBuildInfo ? cliSourceBuildInfo.path : ''}'\n" +
"ZOWE_CLI_PLUGINS_ARTIFACTORY_PATTERN: '${cliPluginsSourceBuildInfo ? cliPluginsSourceBuildInfo.path : ''}'\n" +
"ZOWE_CLI_ARTIFACTORY_BUILD: ''\n" +
"INSTALL_TEST_DEBUG_INFORMATION: 'zowe-install-test:*'\n" +
"SANITY_TEST_DEBUG_INFORMATION: 'zowe-sanity-test:*'\n" +
"Skip Stage: Lint: true\n" +
"Skip Stage: Audit: true\n" +
"Skip Stage: SonarQube Scan: true"
} else {
def testParameters = [
booleanParam(name: 'STARTED_BY_AUTOMATION', value: true),
string(name: 'TEST_SCOPE', value: 'bundle: multiple node versions'),
string(name: 'ZOWE_ARTIFACTORY_PATTERN', value: sourceRegBuildInfo.path),
string(name: 'ZOWE_ARTIFACTORY_BUILD', value: ''),
string(name: 'CLIENT_NODE_VERSION', value: 'v12.18.3'),
string(name: 'INSTALL_TEST_DEBUG_INFORMATION', value: 'zowe-install-test:*'),
string(name: 'SANITY_TEST_DEBUG_INFORMATION', value: 'zowe-sanity-test:*'),
booleanParam(name: 'Skip Stage: Lint', value: true),
booleanParam(name: 'Skip Stage: Audit', value: true),
booleanParam(name: 'Skip Stage: SonarQube Scan', value: true)
]
if (cliSourceBuildInfo && cliSourceBuildInfo.path) {
testParameters.add(string(name: 'ZOWE_CLI_ARTIFACTORY_PATTERN', value: cliSourceBuildInfo.path))
testParameters.add(string(name: 'ZOWE_CLI_ARTIFACTORY_BUILD', value: ''))
}
def test_result = build(
job: '/zowe-install-test/staging',
parameters: testParameters,
propagate: false
)
echo "Test result: ${test_result.result}"
if (test_result.result != 'SUCCESS') {
testMultipleNodeErrorUrl = test_result.absoluteUrl
echo "Test failed on multiple node versions build ${sourceRegBuildInfo.path}, check failure details at ${test_result.absoluteUrl}"
IS_BUILD_UNSTABLE = true
}
}
},
allowMissingJunit : true,
timeout: [time: 2, unit: 'HOURS']
)
pipeline.test(
name : "Zowe Multiple Keyring Modes Build",
shouldExecute : {
return (keyringRun || fullTestRun) && sourceRegBuildInfo && sourceRegBuildInfo['path']
},
operation : {
if (params.TEST_RUN) {
echo "Skip testing with parameters:\n\n" +
"STARTED_BY_AUTOMATION: true\n" +
"TEST_SCOPE: bundle: keyring on multiple security systems\n" +
"ZOWE_ARTIFACTORY_PATTERN: '${sourceRegBuildInfo.path}'\n" +
"ZOWE_ARTIFACTORY_BUILD: ''\n" +
"ZOWE_CLI_ARTIFACTORY_PATTERN: '${cliSourceBuildInfo ? cliSourceBuildInfo.path : ''}'\n" +
"ZOWE_CLI_PLUGINS_ARTIFACTORY_PATTERN: '${cliPluginsSourceBuildInfo ? cliPluginsSourceBuildInfo.path : ''}'\n" +
"ZOWE_CLI_ARTIFACTORY_BUILD: ''\n" +
"INSTALL_TEST_DEBUG_INFORMATION: 'zowe-install-test:*'\n" +
"SANITY_TEST_DEBUG_INFORMATION: 'zowe-sanity-test:*'\n" +
"Skip Stage: Lint: true\n" +
"Skip Stage: Audit: true\n" +
"Skip Stage: SonarQube Scan: true"
} else {
def testParameters = [
booleanParam(name: 'STARTED_BY_AUTOMATION', value: true),
string(name: 'TEST_SCOPE', value: 'bundle: keyring on multiple security systems'),
string(name: 'ZOWE_ARTIFACTORY_PATTERN', value: sourceRegBuildInfo.path),
string(name: 'ZOWE_ARTIFACTORY_BUILD', value: ''),
string(name: 'CLIENT_NODE_VERSION', value: 'v12.18.3'),
string(name: 'INSTALL_TEST_DEBUG_INFORMATION', value: 'zowe-install-test:*'),
string(name: 'SANITY_TEST_DEBUG_INFORMATION', value: 'zowe-sanity-test:*'),
booleanParam(name: 'Skip Stage: Lint', value: true),
booleanParam(name: 'Skip Stage: Audit', value: true),
booleanParam(name: 'Skip Stage: SonarQube Scan', value: true)
]
if (cliSourceBuildInfo && cliSourceBuildInfo.path) {
testParameters.add(string(name: 'ZOWE_CLI_ARTIFACTORY_PATTERN', value: cliSourceBuildInfo.path))
testParameters.add(string(name: 'ZOWE_CLI_ARTIFACTORY_BUILD', value: ''))
}
def test_result = build(
job: '/zowe-install-test/staging',
parameters: testParameters,
propagate: false
)
echo "Test result: ${test_result.result}"
if (test_result.result != 'SUCCESS') {
testMultipleKeyringErrorUrl = test_result.absoluteUrl
echo "Test failed on multiple keyring modes build ${sourceRegBuildInfo.path}, check failure details at ${test_result.absoluteUrl}"
IS_BUILD_UNSTABLE = true
}
}
},
allowMissingJunit : true,
timeout: [time: 2, unit: 'HOURS']
)
pipeline.test(
name : "Zowe Using External Certificates",
shouldExecute : {
return fullTestRun && sourceRegBuildInfo && sourceRegBuildInfo['path']
},
operation : {
if (params.TEST_RUN) {
echo "Skip testing with parameters:\n\n" +
"STARTED_BY_AUTOMATION: true\n" +
"TEST_SERVER: marist-4\n" +
"TEST_SCOPE: external certificate\n" +
"ZOWE_ARTIFACTORY_PATTERN: '${sourceRegBuildInfo.path}'\n" +
"ZOWE_ARTIFACTORY_BUILD: ''\n" +
"ZOWE_CLI_ARTIFACTORY_PATTERN: '${cliSourceBuildInfo ? cliSourceBuildInfo.path : ''}'\n" +
"ZOWE_CLI_PLUGINS_ARTIFACTORY_PATTERN: '${cliPluginsSourceBuildInfo ? cliPluginsSourceBuildInfo.path : ''}'\n" +
"ZOWE_CLI_ARTIFACTORY_BUILD: ''\n" +
"INSTALL_TEST_DEBUG_INFORMATION: 'zowe-install-test:*'\n" +
"SANITY_TEST_DEBUG_INFORMATION: 'zowe-sanity-test:*'\n" +
"Skip Stage: Lint: true\n" +
"Skip Stage: Audit: true\n" +
"Skip Stage: SonarQube Scan: true"
} else {
def testParameters = [
booleanParam(name: 'STARTED_BY_AUTOMATION', value: true),
string(name: 'TEST_SERVER', value: 'marist-4'),
string(name: 'TEST_SCOPE', value: 'external certificate'),
string(name: 'ZOWE_ARTIFACTORY_PATTERN', value: sourceRegBuildInfo.path),
string(name: 'ZOWE_ARTIFACTORY_BUILD', value: ''),
string(name: 'CLIENT_NODE_VERSION', value: 'v12.18.3'),
string(name: 'INSTALL_TEST_DEBUG_INFORMATION', value: 'zowe-install-test:*'),
string(name: 'SANITY_TEST_DEBUG_INFORMATION', value: 'zowe-sanity-test:*'),
booleanParam(name: 'Skip Stage: Lint', value: true),
booleanParam(name: 'Skip Stage: Audit', value: true),
booleanParam(name: 'Skip Stage: SonarQube Scan', value: true)
]
if (cliSourceBuildInfo && cliSourceBuildInfo.path) {
testParameters.add(string(name: 'ZOWE_CLI_ARTIFACTORY_PATTERN', value: cliSourceBuildInfo.path))
testParameters.add(string(name: 'ZOWE_CLI_ARTIFACTORY_BUILD', value: ''))
}
def test_result = build(
job: '/zowe-install-test/staging',
parameters: testParameters,
propagate: false
)
echo "Test result: ${test_result.result}"
if (test_result.result != 'SUCCESS') {
testExternalCertificates = test_result.absoluteUrl
echo "Test failed on using external certificate on build ${sourceRegBuildInfo.path}, check failure details at ${test_result.absoluteUrl}"
IS_BUILD_UNSTABLE = true
}
}
},
allowMissingJunit : true,
timeout: [time: 1, unit: 'HOURS']
)
pipeline.createStage(
name : "Promote",
isSkippable : true,
shouldExecute : {
return sourceSmpeBuildInfo && sourceSmpeBuildInfo['path'] &&
sourceRegBuildInfo && sourceRegBuildInfo['path'] &&
sourceContainerizationBuildInfo && sourceContainerizationBuildInfo['path']
},
stage : {
// promote Zowe nightly build
targetSmpeFullPath = pipeline.artifactory.promote([
'source' : sourceSmpeBuildInfo,
'targetPath' : "${ZOWE_RELEASE_REPOSITORY}${ZOWE_RELEASE_PATH}/"
])
targetRegFullPath = pipeline.artifactory.promote([
'source' : sourceRegBuildInfo,
'targetPath' : "${ZOWE_RELEASE_REPOSITORY}${ZOWE_RELEASE_PATH}/"
])
targetDockeramd64FullPath = pipeline.artifactory.promote([
'source' : sourceDockerAmd64BuildInfo,
'targetPath' : "${ZOWE_RELEASE_REPOSITORY}${ZOWE_RELEASE_PATH}/"
])
targetContainerizationFullPath = pipeline.artifactory.promote([
'source' : sourceContainerizationBuildInfo,
'targetPath' : "${ZOWE_RELEASE_REPOSITORY}${ZOWE_RELEASE_PATH}/"
])
// promote Zowe CLI nightly build
if (cliSourceBuildInfo) {
try {
cliTargetFullPath = pipeline.artifactory.promote([
'source' : cliSourceBuildInfo,
'targetPath' : "${ZOWE_RELEASE_REPOSITORY}${ZOWE_CLI_RELEASE_PATH}/"
])
} catch (errCli) {
echo "promote CLI core package failed: ${errCli}"
}
}
if (cliPluginsSourceBuildInfo) {
try {
cliPluginsTargetFullPath = pipeline.artifactory.promote([
'source' : cliPluginsSourceBuildInfo,
'targetPath' : "${ZOWE_RELEASE_REPOSITORY}${ZOWE_CLI_RELEASE_PATH}/"
])
} catch (errCliPlugin) {
echo "promote CLI plugins package failed: ${errCliPlugin}"
}
}
},
timeout: [time: 10, unit: 'MINUTES']
)
pipeline.createStage(
name : "Message",
isSkippable : true,
stage : {
// update build description with build ID
currentBuild.description = "${ZOWE_BUILD_NAME}#${sourceRegBuildInfo['build.number']}".toString()
def slackColor = 'good'
def message = "Zowe Build ${ZOWE_BUILD_NAME}#${sourceRegBuildInfo['build.number']} is promoted as nightly build. You can download from:\n\n" +
"${lib.Constants.DEFAULT_LFJ_ARTIFACTORY_URL}/${targetRegFullPath}\n\n" +
"${lib.Constants.DEFAULT_LFJ_ARTIFACTORY_URL}/${targetSmpeFullPath}\n\n" +
"${lib.Constants.DEFAULT_LFJ_ARTIFACTORY_URL}/${targetDockeramd64FullPath}\n\n" +
"${lib.Constants.DEFAULT_LFJ_ARTIFACTORY_URL}/${targetContainerizationFullPath}\n\n"
if (cliSourceBuildInfo) {
if (cliTargetFullPath) {
message += "\n\n" +
"The CLI Core Package ${ZOWE_CLI_BUILD_NAME}#${cliSourceBuildInfo['build.number']} is promoted as nightly CLI build. You can download from:\n\n" +
"${lib.Constants.DEFAULT_LFJ_ARTIFACTORY_URL}/${cliTargetFullPath}"
} else {
slackColor = 'warning'
message += "\n\n" +
"!!WARNING!! Failed to promote CLI Core Package"
}
}
if (cliPluginsSourceBuildInfo) {
if (cliPluginsTargetFullPath) {
message += "\n\n" +
"The CLI Plugins Package ${ZOWE_CLI_BUILD_NAME}#${cliPluginsSourceBuildInfo['build.number']} is promoted as nightly CLI build. You can download from:\n\n" +
"${lib.Constants.DEFAULT_LFJ_ARTIFACTORY_URL}/${cliPluginsTargetFullPath}"
} else {
slackColor = 'warning'
message += "\n\n" +
"!!WARNING!! Failed to promote CLI Plguins Package"
}
}
if (testRegBuildErrorUrl) {
slackColor = 'warning'
message = message + "\n\n" +
"!!WARNING!! Smoke test FAILED on the regular build! Check test result here: " +
testRegBuildErrorUrl + "\n"
}
if (testSmpeBuildErrorUrl) {
slackColor = 'warning'
message = message + "\n\n" +
"!!WARNING!! Smoke test FAILED on the SMP/e build! Check test result here: " +
testSmpeBuildErrorUrl + "\n"
}
if (testDockerBuildErrorUrl) {
slackColor = 'warning'
message = message + "\n\n" +
"!!WARNING!! Smoke test FAILED on the docker amd-64 image! Check test result here: " +
testDockerBuildErrorUrl + "\n"
}
if (testMultipleNodeErrorUrl) {
slackColor = 'warning'
message = message + "\n\n" +
"!!WARNING!! Smoke test FAILED on the multiple node versions build! Check test result here: " +
testMultipleNodeErrorUrl + "\n"
}
if (testMultipleKeyringErrorUrl) {
slackColor = 'warning'
message = message + "\n\n" +
"!!WARNING!! Smoke test FAILED on the multiple keyring modes build! Check test result here: " +
testMultipleKeyringErrorUrl + "\n"
}
if (testExternalCertificates) {
slackColor = 'warning'
message = message + "\n\n" +
"!!WARNING!! Smoke test FAILED on using external certificate! Check test result here: " +
testExternalCertificates + "\n"
}
echo "*************************************************************************************************\n" +
message + "\n" +
"*************************************************************************************************"
def slackMessage = "${message}\n\nCheck pipeline detail: ${env.BUILD_URL}"
if (IS_BUILD_UNSTABLE) {
currentBuild.result = 'UNSTABLE'
}
if (params.TEST_RUN) {
echo "Slack message in ${slackColor}:\n${slackMessage}"
} else {
slackSend channel: SLACK_CHANNEL,
color: slackColor,
message: slackMessage
}
},
timeout: [time: 2, unit: 'MINUTES']
)
pipeline.end()
}