forked from hyperledger-archives/indy-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile.cd
710 lines (575 loc) · 25.6 KB
/
Jenkinsfile.cd
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
#!groovy
@Library('SovrinHelpers') _
properties([
[$class: 'BuildDiscarderProperty', strategy: [
$class : 'LogRotator',
artifactDaysToKeepStr: '28',
artifactNumToKeepStr : '',
daysToKeepStr : '28',
numToKeepStr : ''
]]
]);
try {
testing()
publishing()
if (acceptanceTesting()) {
releasing()
}
notifyingSuccess()
} catch (err) {
notifyingFailure()
throw err
}
def testing() {
stage('Testing') {
parallel([
'ubuntu-test' : { ubuntuTesting() },
'redhat-test' : { rhelTesting() },
'windows-test': { windowsTesting() }
])
}
}
def publishing() {
stage('Publishing') {
echo "${env.BRANCH_NAME}: start publishing"
publishedVersions = parallel([
//FIXME fix and restore 'rhel-files' : { rhelPublishing() }, IS-307
'ubuntu-files' : { ubuntuPublishing() },
'windows-files': { windowsPublishing() },
])
if (publishedVersions['windows-files'] != publishedVersions['ubuntu-files']) { // FIXME check rhel too, IS-307
error "platforms artifacts have different versions"
}
}
}
def acceptanceTesting() {
stage('Acceptance testing') {
if (env.BRANCH_NAME == 'rc') {
echo "${env.BRANCH_NAME}: acceptance testing"
if (approval.check("default")) {
return true
}
} else {
echo "${env.BRANCH_NAME}: skip acceptance testing"
}
return false
}
}
def releasing() {
stage('Releasing') {
if (env.BRANCH_NAME == 'rc') {
publishingRCtoStable()
}
}
}
def notifyingSuccess() {
currentBuild.result = "SUCCESS"
node('ubuntu-master') {
sendNotification.success('indy-sdk')
}
}
def notifyingFailure() {
currentBuild.result = "FAILED"
node('ubuntu-master') {
sendNotification.fail([slack: true])
}
}
def getBuildPoolVerOptions(pool_type, plenum_ver, anoncreds_ver, node_ver) {
if (pool_type != null && plenum_ver != null && anoncreds_ver != null && node_ver != null) {
return "--build-arg=indy_stream=${pool_type} --build-arg indy_plenum_ver=${plenum_ver} --build-arg indy_anoncreds_ver=${anoncreds_ver} --build-arg indy_node_ver=${node_ver}"
} else {
return ""
}
}
def dockerClean(env_name, network_name) {
try {
try {
sh "docker ps --format '{{.ID}}' --filter network=${network_name} | xargs docker rm -f || true"
//TODO: FIXME
} catch (error) {
echo "${env_name} Test: error while force clean-up network ${network_name} - ${error}"
}
try {
echo "${env_name} Test: remove pool network ${network_name}"
sh "docker network rm ${network_name} || true" //TODO: FIXME
} catch (error) {
echo "${env_name} Test: error while delete ${network_name} - ${error}"
}
}
finally {
sh "docker container prune -f"
sh "docker network prune -f"
}
}
def openPool(env_name, network_name, pool_type = null, pool_ver = null, plenum_ver = null, anoncreds_ver = null, node_ver = null) {
echo "${env_name} Test: Clean docker"
dockerClean(env_name, network_name)
echo "${env_name} Test: Create docker network (${network_name}) for nodes pool and test image"
sh "docker network create --subnet=10.0.0.0/8 ${network_name}"
echo "${env_name} Test: Build docker image for nodes pool ver. ${pool_ver}"
echo "${env_name} Test: Building nodes pool for versions: plenum ${plenum_ver}, anoncreds ${anoncreds_ver}, node ${node_ver}"
verOptions = getBuildPoolVerOptions(pool_type, plenum_ver, anoncreds_ver, node_ver)
def poolEnv = dockerHelpers.build("indy_pool_${pool_ver}", 'ci/indy-pool.dockerfile ci',
"--build-arg pool_ip=10.0.0.2 ${verOptions}")
echo "${env_name} Test: Run nodes pool"
return poolEnv.run("--ip=\"10.0.0.2\" --network=${network_name}")
}
def closePool(env_name, network_name, poolInst) {
echo "${env_name} Test: Cleanup"
try {
echo "${env_name} Test: stop pool"
poolInst.stop()
} catch (error) {
echo "${env_name} Tests: error while stop pool ${error}"
}
finally {
dockerClean(env_name, network_name)
}
step([$class: 'WsCleanup'])
}
void getSrcVersion(folder) {
commit = sh(returnStdout: true, script: 'git rev-parse HEAD').trim()
def version = sh(returnStdout: true, script: "wget -q https://raw.githubusercontent.com/hyperledger/indy-sdk/$commit/$folder/Cargo.toml -O - | grep -E '^version =' | head -n1 | cut -f2 -d= | cut -f2 -d '\"'").trim()
return version
}
def linuxTesting(file, env_name, network_name, stashBuildResults) {
def poolInst
try {
echo "${env_name} Test: Checkout csm"
checkout scm
poolInst = openPool(env_name, network_name)
def testEnv
dir('libindy') {
echo "${env_name} Libindy Test: Build docker image"
testEnv = dockerHelpers.build('libindy', file)
testEnv.inside("--ip=\"10.0.0.3\" --network=${network_name}") {
echo "${env_name} Test: Test"
try {
def libindyFeatures = "--features sodium_static"
def libindyBuildFeatures = "--features \"fatal_warnings sodium_static\""
echo "${env_name} Libindy Test: Build"
sh "RUST_BACKTRACE=1 cargo build --release $libindyBuildFeatures"
echo "${env_name} Libindy Test: Build tests"
sh "RUST_BACKTRACE=1 cargo test --release --no-run $libindyFeatures"
echo "${env_name} Libindy Test: Run tests"
sh "RUST_BACKTRACE=1 RUST_LOG=indy::=debug,zmq=trace RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --release $libindyFeatures"
if (stashBuildResults) {
stash includes: 'target/release/libindy.so,target/release/libindy.a', name: 'LibindyUbuntuBuildResult'
}
/* TODO FIXME restore after xunit will be fixed
sh 'RUST_TEST_THREADS=1 cargo test-xunit'
*/
}
finally {
/* TODO FIXME restore after xunit will be fixed
junit 'test-results.xml'
*/
}
}
}
sh "cp libindy/target/release/libindy.so wrappers/java/lib"
dir('wrappers/java') {
testEnv.inside("--ip=\"10.0.0.3\" --network=${network_name}") {
echo "${env_name} Libindy Test: Test java wrapper"
sh "RUST_LOG=indy::=debug,zmq=trace TEST_POOL_IP=10.0.0.2 mvn clean test"
}
}
sh "cp libindy/target/release/libindy.so wrappers/python"
dir('wrappers/python') {
testEnv.inside("--ip=\"10.0.0.3\" --network=${network_name}") {
echo "${env_name} Libindy Test: Test python wrapper"
sh '''
python3.5 -m pip install --user -e .
LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_LOG=indy::=debug,zmq=trace TEST_POOL_IP=10.0.0.2 python3.5 -m pytest
'''
}
}
sh "cp libindy/target/release/libindy.so libnullpay"
dir('libnullpay') {
testEnv.inside("--ip=\"10.0.0.3\" --network=${network_name}") {
echo "${env_name} Libnullpay Test: Build"
sh "LIBRARY_PATH=./ RUST_BACKTRACE=1 cargo test --release --no-run"
echo "${env_name} Libnullpay Test: Run tests"
sh 'LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=indy::=debug,zmq=trace RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --release'
if (stashBuildResults) {
stash includes: 'target/release/libnullpay.so', name: 'LibnullpayUbuntuBuildResult'
}
}
}
sh "cp libnullpay/target/release/libnullpay.so cli"
sh "cp libindy/target/release/libindy.so cli"
dir('cli') {
testEnv.inside("--ip=\"10.0.0.3\" --network=${network_name}") {
echo "${env_name} Indy Cli Test: Build"
sh "LIBRARY_PATH=./ RUST_BACKTRACE=1 cargo build --release --features fatal_warnings"
echo "${env_name} Indy Cli Test: Build Tests"
sh 'LIBRARY_PATH=./ RUST_BACKTRACE=1 cargo test --release --features "nullpay_plugin" --no-run'
echo "${env_name} Indy Cli Test: Run tests"
sh 'LD_LIBRARY_PATH=./:${LD_LIBRARY_PATH} RUST_BACKTRACE=1 RUST_LOG=indy::=debug,zmq=trace RUST_TEST_THREADS=1 TEST_POOL_IP=10.0.0.2 cargo test --release --features "nullpay_plugin"'
if (stashBuildResults) {
stash includes: 'target/release/indy-cli', name: 'IndyCliUbuntuBuildResult'
}
}
}
}
finally {
closePool(env_name, network_name, poolInst)
}
}
def windowsTesting() {
node('win2016') {
stage('Windows Test') {
def ws_path = "workspace/${env.JOB_NAME}".replace(' ', '_')
ws(ws_path) {
try {
echo "Windows Test: Checkout scm"
checkout scm
echo "Windows Test: Run Indy pool"
bat "docker -H $INDY_SDK_SERVER_IP build --build-arg pool_ip=$INDY_SDK_SERVER_IP -f ci/indy-pool.dockerfile -t indy_pool ci"
bat "docker -H $INDY_SDK_SERVER_IP run -d --network host --name indy_pool -p 9701-9708:9701-9708 indy_pool"
setupRust()
dir('libindy') {
echo "Windows Test: Download prebuilt dependencies"
bat 'wget -O prebuilt.zip "https://repo.sovrin.org/windows/libindy/deps/indy-sdk-deps.zip"'
bat 'unzip prebuilt.zip -d prebuilt'
echo "Windows Libindy Test: Build"
withEnv([
"INDY_PREBUILT_DEPS_DIR=$WORKSPACE\\libindy\\prebuilt",
"INDY_CRYPTO_PREBUILT_DEPS_DIR=$WORKSPACE\\libindy\\prebuilt",
"MILAGRO_DIR=$WORKSPACE\\libindy\\prebuilt",
"LIBZMQ_PREFIX=$WORKSPACE\\libindy\\prebuilt",
"SODIUM_LIB_DIR=$WORKSPACE\\libindy\\prebuilt",
"OPENSSL_DIR=$WORKSPACE\\libindy\\prebuilt",
"PATH=$WORKSPACE\\libindy\\prebuilt\\lib;$PATH",
"RUST_BACKTRACE=1"
]) {
bat "cargo build --release --features fatal_warnings"
bat "cargo test --release --no-run"
echo "Windows Libindy Test: Run tests"
withEnv([
"RUST_TEST_THREADS=1",
"RUST_LOG=indy::=debug,zmq=trace",
"TEST_POOL_IP=$INDY_SDK_SERVER_IP"
]) {
bat "cargo test --release"
}
}
stash includes: 'target/release/*.dll', name: 'LibindyWindowsBuildResult'
}
dir('libnullpay') {
echo "Windows Libnullpay Test: Build"
withEnv([
"RUST_BACKTRACE=1"
]) {
bat "cargo build --release --features fatal_warnings"
bat "cargo test --release --no-run"
echo "Windows Libnullpay Test: Run tests"
withEnv([
"RUST_TEST_THREADS=1",
"RUST_LOG=indy::=debug,zmq=trace",
"TEST_POOL_IP=$INDY_SDK_SERVER_IP",
"PATH=$WORKSPACE\\libindy\\target\\release;$PATH",
]) {
bat "cargo test --release"
}
}
stash includes: 'target/release/*.dll', name: 'LibnullpayWindowsBuildResult'
}
bat "copy $WORKSPACE\\libnullpay\\target\\release\\nullpay.dll $WORKSPACE\\cli"
dir('cli') {
bat "sed -i -e \"s/10\\.0\\.0\\.2/${INDY_SDK_SERVER_IP}/g\" docker_pool_transactions_genesis"
def featuresArgs = '--features "nullpay_plugin"'
echo "Windows Indy Cli Test: Build"
withEnv([
"RUST_BACKTRACE=1"
]) {
bat "cargo build --release --features fatal_warnings"
echo "Windows Indy Cli Test: Build tests"
bat "cargo test --release $featuresArgs --no-run"
echo "Windows Indy Cli Test: Run tests"
withEnv([
"RUST_TEST_THREADS=1",
"RUST_LOG=indy::=debug,zmq=trace",
"TEST_POOL_IP=$INDY_SDK_SERVER_IP"
]) {
bat "cargo test --release $featuresArgs"
}
}
stash includes: 'target/release/indy-cli.exe,target/release/*.dll', name: 'IndyCliWindowsBuildResult'
}
//TODO wrappers testing
} finally {
try {
bat "docker -H $INDY_SDK_SERVER_IP stop indy_pool"
} catch (ignore) {
}
try {
bat "docker -H $INDY_SDK_SERVER_IP rm indy_pool"
} catch (ignore) {
}
cleanWs()
}
}
cleanWs()
}
}
}
def ubuntuTesting() {
node('ubuntu') {
stage('Ubuntu Test') {
linuxTesting("ci/ubuntu.dockerfile ci", "Ubuntu", "pool_network", true)
}
}
}
def rhelTesting() {
node('ubuntu') {
stage('RedHat Test') {
linuxTesting("ci/amazon.dockerfile ci", "RedHat", "pool_network", false)
}
}
}
def rhelPublishing() {
def libindyVersion;
node('ubuntu') {
stage('Publish Libindy RPM Files') {
try {
echo 'Publish Rpm files: Checkout csm'
checkout scm
libindyVersion = getSrcVersion("libindy")
dir('libindy') {
echo 'Publish Rpm: Build docker image'
def testEnv = dockerHelpers.build('indy-sdk', 'ci/amazon.dockerfile ci')
testEnv.inside('-u 0:0') {
sh 'chmod -R 777 ci'
withCredentials([file(credentialsId: 'EvernymRepoSSHKey', variable: 'repo_key')]) {
sh "./ci/libindy-rpm-build-and-upload.sh $version $repo_key $env.BRANCH_NAME $env.BUILD_NUMBER"
}
}
}
}
finally {
echo 'Publish RPM: Cleanup'
step([$class: 'WsCleanup'])
}
}
}
return libindyVersion
}
def ubuntuPublishing() {
def libindyVersion
node('ubuntu') {
stage('Publish Ubuntu Files') {
try {
echo 'Publish Ubuntu files: Checkout csm'
checkout scm
libindyVersion = getSrcVersion("libindy")
echo 'Publish Ubuntu files: Build docker image'
testEnv = dockerHelpers.build('indy-sdk', 'libindy/ci/ubuntu.dockerfile libindy/ci')
libindyDebPublishing(testEnv, libindyVersion)
pythonWrapperPublishing(testEnv, false)
javaWrapperPublishing(testEnv, false)
libindyCliDebPublishing(testEnv, libindyVersion)
libnullpayDebPublishing(testEnv)
}
finally {
echo 'Publish Ubuntu files: Cleanup'
step([$class: 'WsCleanup'])
}
}
}
return libindyVersion
}
def windowsPublishing() {
def libindyVersion
node('ubuntu') {
stage('Publish Libindy Windows Files') {
try {
echo 'Publish Windows files: Checkout csm'
checkout scm
libindyVersion = getSrcVersion("libindy")
echo 'Publish Windows files: Build docker image'
testEnv = dockerHelpers.build('indy-sdk', 'libindy/ci/ubuntu.dockerfile libindy/ci')
echo 'Publish Libindy Windows files'
windowsPublishArtifact(testEnv, "libindy", "libindy", "lib", libindyVersion, "LibindyWindowsBuildResult")
echo 'Publish Indy Cli Windows files'
windowsPublishArtifact(testEnv, "cli", "indy-cli", "executable", libindyVersion, "IndyCliWindowsBuildResult")
def libnullpayVersion = getSrcVersion("libnullpay")
echo 'Publish Libnullpay Cli Windows files'
windowsPublishArtifact(testEnv, "libnullpay", "libnullpay", "lib", libnullpayVersion, "LibnullpayWindowsBuildResult")
}
finally {
echo 'Publish Windows files: Cleanup'
step([$class: 'WsCleanup'])
}
}
}
return libindyVersion
}
def windowsPublishArtifact(testEnv, folder, packageName, packageType, packageVersion, stashName) {
testEnv.inside {
sh 'chmod -R 777 ci'
unstash name: stashName
withCredentials([file(credentialsId: 'SovrinRepoSSHKey', variable: 'repo_key')]) {
sh "ci/win-zip-and-upload.sh $folder $packageName $packageType $packageVersion '${repo_key}' $env.BRANCH_NAME $env.BUILD_NUMBER"
}
}
}
def getSuffix(isRelease, target) {
def suffix
if (env.BRANCH_NAME == 'master' && !isRelease) {
suffix = "-dev-$env.BUILD_NUMBER"
} else if (env.BRANCH_NAME == 'rc') {
if (isRelease) {
suffix = ""
} else {
suffix = "-rc-$env.BUILD_NUMBER"
}
} else {
error "Publish To ${target}: invalid case: branch ${env.BRANCH_NAME}, isRelease ${isRelease}"
}
return suffix
}
def libindyDebPublishing(testEnv, version) {
echo 'Publish Libindy deb files to Apt'
debPublishing(testEnv, "libindy", "libindy", version, "LibindyUbuntuBuildResult", "libindyDebs")
}
def libindyCliDebPublishing(testEnv, version) {
echo 'Publish Indy Cli deb files to Apt'
debPublishing(testEnv, "cli", "indy-cli", version, "IndyCliUbuntuBuildResult", "libindyCliDebs")
}
def libnullpayDebPublishing(testEnv) {
echo 'Publish Libnullpay deb files to Apt'
def libnullpayVersion = getSrcVersion("libnullpay")
debPublishing(testEnv, "libnullpay", "libnullpay", libnullpayVersion, "LibnullpayUbuntuBuildResult", "libnullpayDebs")
}
def debPublishing(testEnv, directory, packageName, version, inStashName, outStashName) {
dir("$directory/sovrin-packaging") {
downloadPackagingUtils()
}
testEnv.inside {
sh "cp ci/deb-build-and-upload.sh $directory && chmod -R 755 $directory/*.sh"
def suffix = "~$env.BUILD_NUMBER"
unstash name: inStashName
sh "mkdir --parent $directory/target/release/ && mv target/release/* $directory/target/release/"
withCredentials([file(credentialsId: 'SovrinRepoSSHKey', variable: 'sovrin_key')]) {
sh "cd $directory && ./deb-build-and-upload.sh $packageName $version $env.BRANCH_NAME $suffix $SOVRIN_SDK_REPO_NAME $SOVRIN_REPO_HOST $sovrin_key"
if (env.BRANCH_NAME == 'rc') {
stash includes: "$directory/debs/*", name: outStashName
}
}
}
}
def pythonWrapperPublishing(testEnv, isRelease) {
dir('wrappers/python') {
def suffix = getSuffix(isRelease, "Pypi")
testEnv.inside {
withCredentials([file(credentialsId: 'pypi_credentials', variable: 'credentialsFile')]) {
sh 'cp $credentialsFile ./'
sh "sed -i -E \"s/version='([0-9,.]+).*/version='\\1$suffix',/\" setup.py"
sh '''
python3.5 setup.py sdist
python3.5 -m twine upload dist/* --config-file .pypirc
'''
}
}
}
}
def javaWrapperPublishing(testEnv, isRelease) {
dir('wrappers/java') {
echo "Publish To Maven Test: Build docker image"
def suffix = getSuffix(isRelease, "Maven")
testEnv.inside {
echo "Publish To Maven Test: Test"
sh "sed -i -E -e 'H;1h;\$!d;x' -e \"s/<version>([0-9,.]+)</<version>\\1$suffix</\" pom.xml"
withCredentials([file(credentialsId: 'artifactory-evernym-settings', variable: 'settingsFile')]) {
sh 'cp $settingsFile .'
sh "mvn clean deploy -DskipTests --settings settings.xml"
}
}
}
}
def publishingRCtoStable() {
node('ubuntu') {
stage('Moving RC artifacts to Stable') {
try {
echo 'Moving RC artifacts to Stable: Checkout csm'
checkout scm
echo 'Moving RC artifacts to Stable: Download packaging utils'
dir('sovrin-packaging') {
downloadPackagingUtils()
}
def libindyVersion = getSrcVersion("libindy")
echo 'Moving Windows RC artifacts to Stable: libindy'
publishLibindyWindowsFilesRCtoStable(libindyVersion)
echo 'Moving RC artifacts to Stable: Build docker image for wrappers publishing'
testEnv = dockerHelpers.build('indy-sdk', 'libindy/ci/ubuntu.dockerfile libindy/ci')
echo 'Moving Ubuntu RC artifacts to Stable: libindy'
publishLibindyDebRCtoStable(testEnv, libindyVersion)
echo 'Moving Ubuntu RC artifacts to Stable: python wrapper'
pythonWrapperPublishing(testEnv, true)
echo 'Moving Ubuntu RC artifacts to Stable: java wrapper'
javaWrapperPublishing(testEnv, true)
echo 'Moving Ubuntu RC artifacts to Stable: indy-cli'
publishLibindyCliDebRCtoStable(testEnv, libindyVersion)
echo 'Moving Windows RC artifacts to Stable: indy-cli'
publishLibindyCliWindowsFilesRCtoStable(libindyVersion)
echo 'Moving Windows RC artifacts to Stable: libnullpay'
publishLibnullpayWindowsFilesRCtoStable()
echo 'Moving Ubuntu RC artifacts to Stable: libnullpay'
publishLibnullpayDebRCtoStable(testEnv)
} finally {
echo 'Moving RC artifacts to Stable: Cleanup'
step([$class: 'WsCleanup'])
}
}
}
}
def publishLibindyWindowsFilesRCtoStable(version) {
publishWindowsFilesRCtoStable("libindy", version)
}
def publishLibindyCliWindowsFilesRCtoStable(version) {
publishWindowsFilesRCtoStable("indy-cli", version)
}
def publishLibnullpayWindowsFilesRCtoStable() {
def libnullpayVersion = getSrcVersion("libnullpay")
publishWindowsFilesRCtoStable("libnullpay", libnullpayVersion)
}
def publishWindowsFilesRCtoStable(packageName, version) {
rcFullVersion = "${version}-${env.BUILD_NUMBER}"
withCredentials([file(credentialsId: 'SovrinRepoSSHKey', variable: 'sovrin_repo_key')]) {
src = "/var/repository/repos/windows/$packageName/rc/$rcFullVersion/"
target = "/var/repository/repos/windows/$packageName/stable/$version"
sh "ssh -v -oStrictHostKeyChecking=no -i '$sovrin_repo_key' repo@192.168.11.115 '! ls $target'"
sh "ssh -v -oStrictHostKeyChecking=no -i '$sovrin_repo_key' repo@192.168.11.115 cp -r $src $target"
}
}
def publishLibindyDebRCtoStable(testEnv, version) {
publishDebRCtoStable(testEnv, "libindy", "libindy", version, "libindyDebs", true)
}
def publishLibindyCliDebRCtoStable(testEnv, version) {
publishDebRCtoStable(testEnv, "indy-cli", "cli", version, "libindyCliDebs", false)
}
def publishLibnullpayDebRCtoStable(testEnv) {
def libnullpayVersion = getSrcVersion("libnullpay")
publishDebRCtoStable(testEnv, "libnullpay", "libnullpay", libnullpayVersion, "libnullpayDebs", false)
}
def publishDebRCtoStable(testEnv, packageName, folder, version, stashName, moveDevArtifacts) {
testEnv.inside {
rcFullVersion = "${version}~${env.BUILD_NUMBER}"
unstash name: stashName
sh "fakeroot deb-reversion -v $version $folder/debs/\"$packageName\"_\"$rcFullVersion\"_amd64.deb"
if (moveDevArtifacts) {
sh "fakeroot deb-reversion -v $version $folder/debs/\"$packageName\"-dev_\"$rcFullVersion\"_amd64.deb"
}
withCredentials([file(credentialsId: 'SovrinRepoSSHKey', variable: 'sovrin_key')]) {
path = sh(returnStdout: true, script: 'pwd').trim()
sh "./sovrin-packaging/upload_debs.py $path $SOVRIN_SDK_REPO_NAME stable --host $SOVRIN_REPO_HOST --ssh-key $sovrin_key"
}
}
}
def downloadPackagingUtils() {
git branch: 'master', credentialsId: 'evernym-github-machine-user', url: 'https://github.com/evernym/sovrin-packaging'
}
def setupRust() {
sh "rustup default 1.26.0"
}