forked from zowe/zowe-install-packaging
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile.release
585 lines (533 loc) · 22.9 KB
/
Jenkinsfile.release
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
#!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('ibm-jenkins-slave-nvm') {
def lib = library("jenkins-library").org.zowe.jenkins_shared_library
def ZOWE_RELEASE_REPOSITORY = 'libs-release-local'
def ZOWE_RELEASE_PATH = '/org/zowe'
def ZOWE_RELEASE_FILEPATTERN = "zowe-*.pax"
def ZOWE_RELEASE_SMPE_PAX_FILEPATTERN = "AZWE*.pax.Z"
def ZOWE_RELEASE_SMPE_README_FILEPATTERN = "AZWE*.txt"
def ZOWE_RELEASE_CLI_FILEPATTERN = "zowe-cli-package-*.zip"
def ZOWE_INSTALL_PACKAGING_REPO = 'zowe/zowe-install-packaging'
def pipeline = lib.pipelines.generic.GenericPipeline.new(this)
def github = lib.scm.GitHub.new(this)
def isFormalRelease = false
def releaseFilePath
def releaseArtifacts = readJSON(text:'{}')
def publishFilePath
pipeline.admins.add("jackjia", "markackert")
// we have extra parameters for the pipeline
pipeline.addBuildParameters(
string(
name: 'ZOWE_BUILD_REPOSITORY',
description: 'Zowe successful build repository',
defaultValue: 'libs-snapshot-local',
trim: true,
required: true
),
string(
name: 'ZOWE_BUILD_NAME',
description: 'Zowe successful build name',
defaultValue: 'zowe-install-packaging :: master',
trim: true,
required: true
),
string(
name: 'ZOWE_BUILD_NUMBER',
description: 'REQUIRED if ZOWE_BUILD_RC_PATH is empty. Zowe successful build number',
defaultValue: '',
trim: true
),
string(
name: 'ZOWE_BUILD_RC_PATH',
description: 'REQUIRED if ZOWE_BUILD_NUMBER is empty. Zowe RC build artifactory download path. If the build original file has been removed from artifactory, we can promote any existing file. Example: libs-release-local/org/zowe/0.9.3-RC2/zowe-0.9.3-RC2.pax',
defaultValue: '',
trim: true
),
string(
name: 'ZOWE_CLI_BUILD_REPOSITORY',
description: 'Zowe CLI successful build repository',
defaultValue: 'libs-snapshot-local',
trim: true,
required: true
),
string(
name: 'ZOWE_CLI_BUILD_NAME',
description: 'Zowe CLI successful build name',
defaultValue: 'Zowe CLI Bundle :: master',
trim: true,
required: true
),
string(
name: 'ZOWE_CLI_BUILD_NUMBER',
description: 'REQUIRED if ZOWE_CLI_BUILD_RC_PATH is empty. Zowe CLI successful build number',
defaultValue: '',
trim: true
),
string(
name: 'ZOWE_CLI_BUILD_RC_PATH',
description: 'REQUIRED if ZOWE_CLI_BUILD_NUMBER is empty. Zowe CLI build artifactory download path. If the build original file has been removed from artifactory, we can promote any existing file. Example: libs-release-local/org/zowe/0.9.3-RC2/zowe-cli-package-0.9.3.zip',
defaultValue: '',
trim: true
),
string(
name: 'ZOWE_RELEASE_CATEGORY',
description: 'REQUIRED. Zowe release category. For example, stable',
defaultValue: 'stable',
trim: true,
required: true
),
string(
name: 'ZOWE_RELEASE_VERSION',
description: 'REQUIRED. Zowe release version without prefix v. For example, 0.9.0',
defaultValue: '',
trim: true,
required: true
),
// >>>>>>>> SSH access of testing server zOSaaS layer
string(
name: 'PUBLISH_SSH_HOST',
description: 'Host of publishing server',
defaultValue: 'wash.zowe.org',
trim: true,
required: true
),
string(
name: 'PUBLISH_SSH_PORT',
description: 'SSH port of publishing server',
defaultValue: '22',
trim: true,
required: true
),
credentials(
name: 'PUBLISH_SSH_CREDENTIAL',
description: 'The SSH credential used to connect publishing server',
credentialType: 'com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl',
defaultValue: 'ssh-zowe-publish',
required: true
),
string(
name: 'PUBLISH_DIRECTORY',
description: 'Publishing directory',
defaultValue: '/var/www/projectgiza.org/builds',
trim: true,
required: 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_ARTIFACTORY_URL,
usernamePasswordCredential : lib.Constants.DEFAULT_ARTIFACTORY_ROBOT_CREDENTIAL,
]
)
pipeline.build(
name : "Validate",
timeout : [time: 5, unit: 'MINUTES'],
isSkippable : false,
operation : {
if (!params.ZOWE_BUILD_NAME) {
error "ZOWE_BUILD_NAME is required to promote build."
}
if (!params.ZOWE_BUILD_NUMBER && !params.ZOWE_BUILD_RC_PATH) {
error "ZOWE_BUILD_NUMBER or ZOWE_BUILD_RC_PATH is required to promote build."
}
if (!params.ZOWE_CLI_BUILD_NAME) {
error "ZOWE_CLI_BUILD_NAME is required to promote build."
}
if (!params.ZOWE_CLI_BUILD_NUMBER && !params.ZOWE_CLI_BUILD_RC_PATH) {
error "ZOWE_CLI_BUILD_NUMBER or ZOWE_CLI_BUILD_RC_PATH is required to promote build."
}
if (!params.ZOWE_RELEASE_CATEGORY) {
error "ZOWE_RELEASE_CATEGORY is required to promote build."
}
if (!params.ZOWE_RELEASE_VERSION) {
error "ZOWE_RELEASE_VERSION is required to promote build."
}
echo "Checking if ${params.ZOWE_RELEASE_VERSION} is a valid semantic version ..."
// validate release version scheme
// thanks semver/semver, this regular expression comes from
// https://github.com/semver/semver/issues/232#issuecomment-405596809
if (!(params.ZOWE_RELEASE_VERSION ==~ /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/)) {
error "${params.ZOWE_RELEASE_VERSION} is not a valid semantic version."
}
if (params.ZOWE_RELEASE_VERSION ==~ /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/) {
isFormalRelease = true
echo ">>>> Version ${params.ZOWE_RELEASE_VERSION} is considered as a FORMAL RELEASE."
} else {
echo ">>>> Version ${params.ZOWE_RELEASE_VERSION} is NOT considered as a FORMAL RELEASE."
}
// this is the target Artifactory path will be released to
releaseFilePath = "${ZOWE_RELEASE_REPOSITORY}${ZOWE_RELEASE_PATH}/${params.ZOWE_RELEASE_VERSION}".toString()
// check artifactory release path
echo "Checking if ${params.ZOWE_RELEASE_VERSION} already exists in Artifactory ..."
def versionOnArtifactory
try {
versionOnArtifactory = pipeline.artifactory.getArtifact(releaseFilePath)
} catch (e) {
// ignore errors
}
if (versionOnArtifactory && versionOnArtifactory.path) {
error "Zowe version ${params.ZOWE_RELEASE_VERSION} already exists (${releaseFilePath})"
} else {
echo ">>>> Target artifactory folder ${releaseFilePath} doesn't exist, may proceed."
}
// check if tag already exists
github.cloneRepository([
email : lib.Constants.DEFAULT_GITHUB_ROBOT_EMAIL,
usernamePasswordCredential : lib.Constants.DEFAULT_GITHUB_ROBOT_CREDENTIAL,
repository : ZOWE_INSTALL_PACKAGING_REPO,
folder : '.tag',
branch : 'master'
])
if (github.tagExistsRemote("v${params.ZOWE_RELEASE_VERSION}")) {
error "Repository tag v${params.ZOWE_RELEASE_VERSION} already exists."
} else {
echo ">>>> Repository tag v${params.ZOWE_RELEASE_VERSION} doesn't exist, may proceed."
}
// find the Zowe build number will be promoted
releaseArtifacts['zowe'] = [:]
releaseArtifacts['zowe']['target'] = "zowe-${params.ZOWE_RELEASE_VERSION}.pax".toString()
if (params.ZOWE_BUILD_RC_PATH) {
def artifact = pipeline.artifactory.getArtifact(params.ZOWE_BUILD_RC_PATH)
if (artifact['build.name'].contains('zowe-promote-publish') &&
artifact['build.parentName'] && artifact['build.parentNumber']) {
artifact['build.name'] = artifact['build.parentName']
artifact['build.number'] = artifact['build.parentNumber']
}
if (artifact['build.name'] && artifact['build.number']) {
releaseArtifacts['zowe']['buildName'] = artifact['build.name']
releaseArtifacts['zowe']['buildNumber'] = artifact['build.number']
} else {
// build info is required to get commit hash
error "Cannot find build information for artifact ${params.ZOWE_BUILD_RC_PATH}"
}
} else {
releaseArtifacts['zowe']['buildName'] = params.ZOWE_BUILD_NAME
releaseArtifacts['zowe']['buildNumber'] = params.ZOWE_BUILD_NUMBER
}
// get zowe build source artifact
releaseArtifacts['zowe']['source'] = pipeline.artifactory.getArtifact([
'pattern' : "${params.ZOWE_BUILD_REPOSITORY}/*/zowe-*.pax",
'build-name' : releaseArtifacts['zowe']['buildName'],
'build-number' : releaseArtifacts['zowe']['buildNumber']
])
echo ">>> Found Zowe build ${releaseArtifacts['zowe']['source']['path']}."
// try to get Zowe build commit hash
def zoweBuildInfo = pipeline.artifactory.getBuildInfo(
releaseArtifacts['zowe']['buildName'],
releaseArtifacts['zowe']['buildNumber']
)
releaseArtifacts['zowe']['revision'] = zoweBuildInfo && zoweBuildInfo['vcsRevision']
if (!("${releaseArtifacts['zowe']['revision']}" ==~ /^[0-9a-fA-F]{40}$/)) { // if it's a SHA-1 commit hash
error "Cannot extract git revision from build \"${releaseArtifacts['zowe']['buildName']}/${releaseArtifacts['zowe']['buildNumber']}\""
}
echo ">>>> Build ${releaseArtifacts['zowe']['buildName']}/${releaseArtifacts['zowe']['buildNumber']} commit hash is ${releaseArtifacts['zowe']['revision']}, may proceed."
// get SMP/e build
try {
def smpePaxSource = pipeline.artifactory.getArtifact([
'pattern' : "${params.ZOWE_BUILD_REPOSITORY}/*/AZWE*.pax.Z",
'build-name' : releaseArtifacts['zowe']['buildName'],
'build-number' : releaseArtifacts['zowe']['buildNumber']
])
if (smpePaxSource['path']) {
echo ">>> Found SMP/e build ${smpePaxSource['path']}."
def FMID = smpePaxSource['path'].split('/').last().split('-').first()
releaseArtifacts['smpe-pax'] = [:]
releaseArtifacts['smpe-pax']['source'] = smpePaxSource
releaseArtifacts['smpe-pax']['target'] = "${FMID}-${params.ZOWE_RELEASE_VERSION}.pax.Z".toString()
}
} catch (e1) {
echo ">>> no SMP/e pax.Z found in the build."
}
// get SMP/e readme
try {
def smpeReadmeSource = pipeline.artifactory.getArtifact([
'pattern' : "${params.ZOWE_BUILD_REPOSITORY}/*/AZWE*.txt",
'build-name' : releaseArtifacts['zowe']['buildName'],
'build-number' : releaseArtifacts['zowe']['buildNumber']
])
if (smpeReadmeSource['path']) {
echo ">>> Found SMP/e readme ${smpeReadmeSource['path']}."
def FMID = smpeReadmeSource['path'].split('/').last().split('-').first()
releaseArtifacts['smpe-readme'] = [:]
releaseArtifacts['smpe-readme']['source'] = smpeReadmeSource
releaseArtifacts['smpe-readme']['target'] = "${FMID}-${params.ZOWE_RELEASE_VERSION}.txt".toString()
}
} catch (e1) {
echo ">>> no SMP/e readme found in the build."
}
// find the Zowe CLI build number will be promoted
releaseArtifacts['cli'] = [:]
releaseArtifacts['cli']['target'] = "zowe-cli-package-${params.ZOWE_RELEASE_VERSION}.zip".toString()
if (params.ZOWE_CLI_BUILD_RC_PATH) {
def artifact = pipeline.artifactory.getArtifact(params.ZOWE_CLI_BUILD_RC_PATH)
if (artifact['build.name'].contains('zowe-promote-publish') &&
artifact['build.parentName'] && artifact['build.parentNumber']) {
artifact['build.name'] = artifact['build.parentName']
artifact['build.number'] = artifact['build.parentNumber']
}
if (artifact['build.name'] && artifact['build.number']) {
releaseArtifacts['cli']['buildName'] = artifact['build.name']
releaseArtifacts['cli']['buildNumber'] = artifact['build.number']
} else {
error "Cannot find build information for artifact ${params.ZOWE_CLI_BUILD_RC_PATH}"
}
} else {
releaseArtifacts['cli']['buildName'] = params.ZOWE_CLI_BUILD_NAME
releaseArtifacts['cli']['buildNumber'] = params.ZOWE_CLI_BUILD_NUMBER
}
// get CLI build source artifact
releaseArtifacts['cli']['source'] = pipeline.artifactory.getArtifact([
'pattern' : "${params.ZOWE_CLI_BUILD_REPOSITORY}/*/zowe-cli-package-*.zip",
'build-name' : releaseArtifacts['cli']['buildName'],
'build-number' : releaseArtifacts['cli']['buildNumber']
])
echo ">>> Found Zowe CLI build ${releaseArtifacts['cli']['source']['path']}."
// try to get Zowe CLI build commit hash
def cliBuildInfo = pipeline.artifactory.getBuildInfo(
releaseArtifacts['cli']['buildName'],
releaseArtifacts['cli']['buildNumber']
)
releaseArtifacts['cli']['revision'] = cliBuildInfo && cliBuildInfo['vcsRevision']
if (!("${releaseArtifacts['cli']['revision']}" ==~ /^[0-9a-fA-F]{40}$/)) { // if it's a SHA-1 commit hash
error "Cannot extract git revision from build \"${releaseArtifacts['cli']['buildName']}/${releaseArtifacts['cli']['buildNumber']}\""
}
echo ">>>> Build ${releaseArtifacts['cli']['buildName']}/${releaseArtifacts['cli']['buildNumber']} commit hash is ${releaseArtifacts['cli']['revision']}, may proceed."
// check publish target directory
publishFilePath = "${params.PUBLISH_DIRECTORY}/${params.ZOWE_RELEASE_CATEGORY}/${params.ZOWE_RELEASE_VERSION}".toString()
withCredentials([usernamePassword(credentialsId: params.PUBLISH_SSH_CREDENTIAL, passwordVariable: 'PASSWORD', usernameVariable: 'USERNAME')]) {
// move to target folder, split and generate hash
def versionOnPublishDir = sh(script:"""SSHPASS=${PASSWORD} sshpass -e ssh -tt -o StrictHostKeyChecking=no -o PubkeyAuthentication=no -p ${params.PUBLISH_SSH_PORT} ${USERNAME}@${params.PUBLISH_SSH_HOST} << EOF
[ -d '${publishFilePath}' ] && exit 1
exit 0
EOF""", returnStatus:true)
echo "Exit code: ${versionOnPublishDir}"
if ("${versionOnPublishDir}" == "1") {
error "Zowe version ${params.ZOWE_RELEASE_VERSION} already exists (${publishFilePath})"
} else {
echo ">>>> Target publish folder doesn't exist, may proceed."
}
}
}
)
pipeline.createStage(
name : "Promote",
isSkippable : true,
stage : {
// debug show releaseArtifacts
writeJSON file: '.tmp-release-artifacts.json', json: releaseArtifacts, pretty: 2
sh '''
set +x
echo All artifacts will be promoted:
echo ===============================================
cat .tmp-release-artifacts.json
echo
echo ===============================================
'''
releaseArtifacts.each { artifact, info ->
echo ">>> Promoting ${artifact} ..."
pipeline.artifactory.promote([
'source': info['source'],
'targetPath': releaseFilePath,
'targetName': info['target']
])
}
},
timeout: [time: 10, unit: 'MINUTES']
)
pipeline.createStage(
name : "Download",
isSkippable : true,
stage : {
// download all promoted artifacts into .release folder
sh 'mkdir -p .release'
def downloadArtifacts = readJSON(text:'{"files":[]}')
def expected = releaseArtifacts.size()
releaseArtifacts.each { artifact, info ->
downloadArtifacts['files'].push([
"pattern" : "${releaseFilePath}/${info['target']}".toString(),
"target" : '.release/',
"flat" : 'true'
])
}
// debug show downloadArtifacts
writeJSON file: '.tmp-download-artifacts.json', json: downloadArtifacts, pretty: 2
sh '''
set +x
echo All promoted artifacts:
echo ===============================================
cat .tmp-download-artifacts.json
echo
echo ===============================================
'''
echo ">>> Downloading all promoted artifacts ..."
pipeline.artifactory.download([
'spec' : '.tmp-download-artifacts.json',
'expected' : expected
])
},
timeout: [time: 20, unit: 'MINUTES']
)
pipeline.createStage(
name : "Sign",
isSkippable : true,
shouldExecute : {
return isFormalRelease
},
stage : {
def signing = lib.package.Signing.new(this)
def uploadArtifacts = readJSON(text:'{"files":[]}')
releaseArtifacts.each { artifact, info ->
echo ">>> Signing ${info['target']} ..."
signing.sign(".release/${info['target']}")
uploadArtifacts['files'].push([
"pattern" : ".release/${info['target']}.asc".toString(),
"target" : releaseFilePath + '/'
])
echo ">>> Generate hash of ${info['target']} ..."
signing.hash(".release/${info['target']}")
uploadArtifacts['files'].push([
"pattern" : ".release/${info['target']}.sha512".toString(),
"target" : releaseFilePath + '/'
])
}
// write code-signing-key-info.json
def signingKeyId = signing.getSigningKey()
sh "curl -o .release/code-signing-key-info.json https://raw.githubusercontent.com/zowe/zowe-install-packaging/master/signing_keys/${signingKeyId}.json"
if (!fileExists('.release/code-signing-key-info.json')) {
error "Failed to download code signing key info json"
}
uploadArtifacts['files'].push([
"pattern" : '.release/code-signing-key-info.json',
"target" : releaseFilePath + '/'
])
// write version, no need to upload to Artifactory
writeFile file: '.release/version', text: params.ZOWE_RELEASE_VERSION
// debug show uploadArtifacts
writeJSON file: '.tmp-upload-artifacts.json', json: uploadArtifacts, pretty: 2
sh '''
set +x
echo All signing results:
echo ===============================================
cat .tmp-upload-artifacts.json
echo
echo ===============================================
'''
echo ">>> Uploading signing results ..."
pipeline.artifactory.upload([spec: '.tmp-upload-artifacts.json'])
},
timeout: [time: 20, unit: 'MINUTES']
)
pipeline.createStage(
name : "Tag Branch",
isSkippable : true,
shouldExecute : {
return isFormalRelease && releaseArtifacts['zowe'] && releaseArtifacts['zowe']['revision']
},
stage : {
echo ">>> Tagging ${releaseArtifacts['zowe']['revision']} as v${params.ZOWE_RELEASE_VERSION} ..."
github.cloneRepository([
email : lib.Constants.DEFAULT_GITHUB_ROBOT_EMAIL,
usernamePasswordCredential : lib.Constants.DEFAULT_GITHUB_ROBOT_CREDENTIAL,
repository : ZOWE_INSTALL_PACKAGING_REPO,
folder : '.tag',
branch : 'master'
])
github.command('git checkout ' + releaseArtifacts['zowe']['revision'])
def commit = github.getLastCommitHash()
if (commit != releaseArtifacts['zowe']['revision']) {
error "Failed to checkout ${releaseArtifacts['zowe']['revision']} for tagging."
}
github.tag("v${params.ZOWE_RELEASE_VERSION}")
},
timeout: [time: 10, unit: 'MINUTES']
)
pipeline.createStage(
name : "Publish",
isSkippable : true,
stage : {
def artifacts = findFiles(glob: '.release/*')
echo "All files in .release: ${artifacts}"
def fileUploads = []
artifacts.each {
if (it != '.' && it != '..') {
fileUploads.push('put ' + it)
}
}
// everything should be in .release folder
withCredentials([
usernamePassword(
credentialsId: params.PUBLISH_SSH_CREDENTIAL,
passwordVariable: 'PASSWORD',
usernameVariable: 'USERNAME'
)
]) {
sh """SSHPASS=${PASSWORD} sshpass -e ssh -tt -o StrictHostKeyChecking=no -o PubkeyAuthentication=no -p ${params.PUBLISH_SSH_PORT} ${USERNAME}@${params.PUBLISH_SSH_HOST} << EOF
mkdir -p ${publishFilePath}
exit 0
EOF"""
// upload to publish server
sh """SSHPASS=${PASSWORD} sshpass -e sftp -o BatchMode=no -o StrictHostKeyChecking=no -o PubkeyAuthentication=no -b - -P ${params.PUBLISH_SSH_PORT} ${USERNAME}@${params.PUBLISH_SSH_HOST} << EOF
cd ${publishFilePath}
${fileUploads.join("\n")}
bye
EOF"""
}
},
timeout: [time: 10, unit: 'MINUTES']
)
pipeline.createStage(
name : "Message",
isSkippable : true,
stage : {
def source = ""
if (params.ZOWE_BUILD_NUMBER) {
source = "Build #${params.ZOWE_BUILD_NUMBER}"
} else if (params.ZOWE_BUILD_RC_PATH) {
source = "File \"${params.ZOWE_BUILD_RC_PATH}\""
}
def smpeMessage = ''
if (releaseArtifacts['smpe-pax'] && releaseArtifacts['smpe-pax']['target'] &&
releaseArtifacts['smpe-readme'] && releaseArtifacts['smpe-readme']['target']) {
smpeMessage = """
SMP/e build:
${lib.Constants.DEFAULT_ARTIFACTORY_URL}/${releaseFilePath}/${releaseArtifacts['smpe-pax']['target']}
or:
https://projectgiza.org/builds/${params.ZOWE_RELEASE_CATEGORY}/${params.ZOWE_RELEASE_VERSION}/${releaseArtifacts['smpe-pax']['target']}
${lib.Constants.DEFAULT_ARTIFACTORY_URL}/${releaseFilePath}/${releaseArtifacts['smpe-readme']['target']}
or:
https://projectgiza.org/builds/${params.ZOWE_RELEASE_CATEGORY}/${params.ZOWE_RELEASE_VERSION}/${releaseArtifacts['smpe-readme']['target']}
"""
}
def successMsg = """
*************************************************************************************************
${source} is promoted as Zowe v${params.ZOWE_RELEASE_VERSION}, you can download from:
${lib.Constants.DEFAULT_ARTIFACTORY_URL}/${releaseFilePath}/${releaseArtifacts['zowe']['target']}
or:
https://projectgiza.org/builds/${params.ZOWE_RELEASE_CATEGORY}/${params.ZOWE_RELEASE_VERSION}/${releaseArtifacts['zowe']['target']}
${smpeMessage}
The CLI Standalone Package is published here:
${lib.Constants.DEFAULT_ARTIFACTORY_URL}/${releaseFilePath}/${releaseArtifacts['cli']['target']}
or:
https://projectgiza.org/builds/${params.ZOWE_RELEASE_CATEGORY}/${params.ZOWE_RELEASE_VERSION}/${releaseArtifacts['cli']['target']}
*************************************************************************************************
"""
echo successMsg
},
timeout: [time: 2, unit: 'MINUTES']
)
pipeline.end()
}