forked from datastax/cpp-driver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
1000 lines (932 loc) · 34.1 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
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
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!groovy
import org.jenkinsci.plugins.workflow.steps.FlowInterruptedException
def initializeEnvironment() {
env.DRIVER_DISPLAY_NAME = 'Cassandra C/C++ Driver'
env.DRIVER_TYPE = 'CASS'
env.DRIVER_METRIC_TYPE = 'oss'
env.DRIVER_BUILD_SCRIPT = '.build.sh'
env.DRIVER_CASSANDRA_HEADER = 'include/cassandra.h'
env.DRIVER_VERSION_HEADER = 'include/cassandra.h'
env.DRIVER_LIBRARY = 'cassandra'
if (env.GIT_URL.contains('cpp-driver-private')) {
env.DRIVER_DISPLAY_NAME = 'private ' + env.DRIVER_DISPLAY_NAME
env.DRIVER_METRIC_TYPE = 'oss-private'
} else if (env.GIT_URL.contains('cpp-dse-driver')) {
env.DRIVER_DISPLAY_NAME = 'DSE C/C++ Driver'
env.DRIVER_TYPE = 'DSE'
env.DRIVER_METRIC_TYPE = 'dse'
env.DRIVER_BUILD_SCRIPT = "cpp-driver/${env.DRIVER_BUILD_SCRIPT}"
env.DRIVER_CASSANDRA_HEADER = 'cpp-driver/include/cassandra.h'
env.DRIVER_VERSION_HEADER = 'include/dse.h'
env.DRIVER_LIBRARY = 'dse'
}
env.DRIVER_VERSION = sh(label: 'Determine driver version', script: '''#!/bin/bash -le
. ${DRIVER_BUILD_SCRIPT}
echo $(get_driver_version "${DRIVER_VERSION_HEADER}" "${DRIVER_TYPE}")''', returnStdout: true).trim()
env.GIT_SHA = "${env.GIT_COMMIT.take(7)}"
env.GITHUB_PROJECT_URL = "https://${GIT_URL.replaceFirst(/(git@|http:\/\/|https:\/\/)/, '').replace(':', '/').replace('.git', '')}"
env.GITHUB_BRANCH_URL = "${GITHUB_PROJECT_URL}/tree/${env.BRANCH_NAME}"
env.GITHUB_COMMIT_URL = "${GITHUB_PROJECT_URL}/commit/${env.GIT_COMMIT}"
if (env.CI_INTEGRATION_ENABLED == 'true') {
sh label: 'Download Apache Cassandra® or DataStax Enterprise', script: '''#!/bin/bash -lex
. ${CCM_ENVIRONMENT_SHELL} ${SERVER_VERSION}
'''
}
sh label: 'Display C++ version and environment information', script: '''#!/bin/bash -le
. ${DRIVER_BUILD_SCRIPT}
# Load CCM environment variables
if [ -f ${HOME}/environment.txt ]; then
set -o allexport
. ${HOME}/environment.txt
set +o allexport
fi
if [ "${OS_DISTRO}" = "osx" ]; then
clang --version
else
g++ --version
fi
cmake --version
printenv | sort
'''
}
def installDependencies() {
sh label: 'Install dependencies', script: '''#!/bin/bash -le
. ${DRIVER_BUILD_SCRIPT}
install_dependencies
if [ -d packaging/packages ]; then
mkdir -p ${OS_DISTRO}/${OS_DISTRO_RELEASE}
cp packaging/packages/libuv* ${OS_DISTRO}/${OS_DISTRO_RELEASE}
fi
'''
}
def buildDriver() {
sh label: 'Build driver', script: '''#!/bin/bash -le
. ${DRIVER_BUILD_SCRIPT}
build_driver "${DRIVER_TYPE}"
mkdir -p ${OS_DISTRO}/${OS_DISTRO_RELEASE}
if [ -f build/cassandra-unit-tests ]; then
cp build/cassandra-unit-tests ${OS_DISTRO}/${OS_DISTRO_RELEASE}
fi
if [ -f build/dse-unit-tests ]; then
cp build/dse-unit-tests ${OS_DISTRO}/${OS_DISTRO_RELEASE}
fi
if [ -f build/cassandra-integration-tests ]; then
cp build/cassandra-integration-tests ${OS_DISTRO}/${OS_DISTRO_RELEASE}
fi
if [ -f build/dse-integration-tests ]; then
cp build/dse-integration-tests ${OS_DISTRO}/${OS_DISTRO_RELEASE}
fi
if [ -f build/CMakeFiles/CMakeOutput.log ]; then
cp build/CMakeFiles/CMakeOutput.log ${OS_DISTRO}/${OS_DISTRO_RELEASE}
fi
if [ -f build//CMakeFiles/CMakeError.log ]; then
cp build//CMakeFiles/CMakeError.log ${OS_DISTRO}/${OS_DISTRO_RELEASE}
fi
'''
}
def validateDriverExports() {
sh label: 'Validate driver exports', script: '''#!/bin/bash -le
. ${DRIVER_BUILD_SCRIPT}
FUNCTIONS+=($(grep -Eoh '(^cass_\\s*(\\w+)\\s*\\()|(^dse_\\s*(\\w+)\\s*\\()' include/dse.h | awk -F '(' '{print $1}'));
FUNCTIONS+=($(grep -Eoh '^cass_\\s*(\\w+)\\s*\\(' ${DRIVER_CASSANDRA_HEADER} | awk -F '(' '{print $1}'))
check_driver_exports "${DRIVER_LIBRARY}" "${FUNCTIONS[@]}"
'''
}
def configureTestingEnvironment() {
sh label: 'Configure testing environment', script: '''#!/bin/bash -le
. ${DRIVER_BUILD_SCRIPT}
configure_testing_environment
'''
}
def buildDocuments() {
sh label: 'Building documents with documentor', script: '''#!/bin/bash -le
documentor --output-directory ${HOME}/docs/drivers/cpp .
'''
sh label: 'Archive documentor generated documents', script: '''#!/bin/bash -le
(
cd ${HOME}/docs/drivers/cpp
prefix=cpp-driver
if [ "${DRIVER_TYPE}" = 'DSE' ]; then
prefix=cpp-dse-driver
fi
tar czf ${WORKSPACE}/${prefix}-documents.tgz -C ${HOME}/docs/drivers/cpp .
)
'''
}
def executeUnitTests() {
def attempt = 0
retry(3) {
try {
timeout(time: 10, unit: 'MINUTES') {
sh label: 'Execute unit tests', script: '''#!/bin/bash -le
. ${DRIVER_BUILD_SCRIPT}
build/cassandra-unit-tests --gtest_output=xml:cassandra-unit-tests-${OS_DISTRO}-${OS_DISTRO_RELEASE}-results.xml
if [ -f build/dse-unit-tests ]; then
build/dse-unit-tests --gtest_output=xml:dse-unit-tests-${OS_DISTRO}-${OS_DISTRO_RELEASE}-results.xml
fi
'''
}
} catch (FlowInterruptedException fie) {
attempt++
def message = "Retry attempt will be performed"
if (attempt >= 3) {
message = "No more retries will be performed"
}
// Work around https://issues.jenkins-ci.org/browse/JENKINS-51454
error "Timeout Has Exceeded: ${message}"
}
}
}
def executeIntegrationTests() {
timeout(time: 5, unit: 'HOURS') {
sh label: 'Execute integration tests', script: '''#!/bin/bash -le
. ${DRIVER_BUILD_SCRIPT}
# Load CCM environment variables
set -o allexport
. ${HOME}/environment.txt
set +o allexport
# Disable exit on non 0
set +e
# Limit execution time on static nodes (no integration tests should be run on static node)
if [ "${OS_VERSION}" != "osx/high-sierra" ]; then
if [ -z "${TEST_FILTER}" ]; then
TEST_FILTER=*
fi
# Limit DBAAS tests to Ubuntu 18.04
if [ "${OS_VERSION}" != "ubuntu/bionic64/cpp" ]; then
# Handle filters with negative filtering already applied
if [[ "${TEST_FILTER}" == *":-"* ]]; then
TEST_FILTER=${TEST_FILTER}:DbaasTests.*
else
TEST_FILTER=${TEST_FILTER}:-DbaasTests.*
fi
fi
# Copy any JAR files to the current working directory
cp build/*.jar .
build/cassandra-integration-tests --${CCM_SERVER_TYPE} \
--category=cassandra \
--gtest_filter=${TEST_FILTER} \
--gtest_output=xml:cassandra-integration-tests-${OS_DISTRO}-${OS_DISTRO_RELEASE}-results.xml \
--version=${CCM_VERSION} \
--verbose || cassandra_error=true
if [ "${CCM_IS_DSE}" = "true" ]; then
build/${DRIVER_LIBRARY}-integration-tests --${CCM_SERVER_TYPE} \
--category=dse \
--gtest_filter=${TEST_FILTER} \
--gtest_output=xml:dse-integration-tests-${OS_DISTRO}-${OS_DISTRO_RELEASE}-results.xml \
--version=${CCM_VERSION} \
--verbose || dse_error=true
fi
# Archive logs if an error occurred and ensure exit status is returned
if [ ${cassandra_error} ] || [ ${dse_error} ]; then
if [ -d log ]; then
mkdir -p ${OS_DISTRO}/${OS_DISTRO_RELEASE}/${CCM_SERVER_TYPE}/${CCM_VERSION}
(
cd log
tar czf ../${OS_DISTRO}/${OS_DISTRO_RELEASE}/${CCM_SERVER_TYPE}/${CCM_VERSION}/${DRIVER_LIBRARY}-integration-tests-driver-logs.tgz *
)
fi
exit 1
fi
fi
'''
}
}
def buildPackagesAndInstallDriver() {
sh label: 'Build packages and install driver', script: '''#!/bin/bash -le
. ${DRIVER_BUILD_SCRIPT}
install_driver
if [ -d packaging/packages ]; then
mkdir -p ${OS_DISTRO}/${OS_DISTRO_RELEASE}
cp packaging/packages/${DRIVER_LIBRARY}-cpp-driver* ${OS_DISTRO}/${OS_DISTRO_RELEASE}
fi
'''
}
def testDriverInstallation() {
sh label: 'Test driver installation', script: '''#!/bin/bash -le
. ${DRIVER_BUILD_SCRIPT}
test_installed_driver "${DRIVER_LIBRARY}"
'''
}
def deployDriver() {
withCredentials([usernameColonPassword(credentialsId: 'drivers-artifactory-upload-username-encrypted-password', variable: 'ARTIFACTORY_CREDENTIALS'),
string(credentialsId: 'artifactory-base-url', variable: 'ARTIFACTORY_BASE_URL')]) {
sh label: 'Deploy driver to Artifactory', script: '''#!/bin/bash -le
. ${DRIVER_BUILD_SCRIPT}
DRIVER_FOLDER=cpp-driver
if [ "${DRIVER_TYPE}" = "DSE" ]; then
DRIVER_FOLDER=cpp-dse-driver
fi
DRIVER_BASE="cpp-php-drivers/${DRIVER_FOLDER}/builds"
curl -u "${ARTIFACTORY_CREDENTIALS}" -T "{$(echo packaging/packages/${DRIVER_LIBRARY}-cpp-driver* | tr ' ' ',')}" "${ARTIFACTORY_BASE_URL}/${DRIVER_BASE}/${DRIVER_VERSION}/${GIT_SHA}/${OS_DISTRO}/${OS_DISTRO_RELEASE}/${DRIVER_LIBRARY}/v${DRIVER_VERSION}/"
curl -u "${ARTIFACTORY_CREDENTIALS}" -T "{$(echo packaging/packages/libuv* | tr ' ' ',')}" "${ARTIFACTORY_BASE_URL}/${DRIVER_BASE}/${DRIVER_VERSION}/${GIT_SHA}/${OS_DISTRO}/${OS_DISTRO_RELEASE}/dependencies/libuv/v${LIBUV_VERSION}/"
'''
}
}
def determineBuildType() {
if (params.ADHOC_BUILD_TYPE == 'BUILD-AND-EXECUTE-TESTS') {
return 'adhoc'
} else if (params.ADHOC_BUILD_TYPE == 'BUILD-DOCUMENTS') {
return 'documents'
}
def buildType = 'commit'
if (env.IS_BUILDING_RELEASE == 'true') {
buildType = 'release'
} else if (params.CI_SCHEDULE != 'DO-NOT-CHANGE-THIS-SELECTION') {
buildType = "${params.CI_SCHEDULE.toLowerCase()}"
}
return buildType
}
def notifySlack(status = 'started') {
// Notify Slack channel for every build except adhoc executions
if (params.ADHOC_BUILD_TYPE != 'BUILD-AND-EXECUTE-TESTS') {
// Set the global pipeline scoped environment (this is above each matrix)
env.BUILD_STATED_SLACK_NOTIFIED = 'true'
def buildType = determineBuildType()
if (buildType == 'release') {
buildType += "v${env.DRIVER_VERSION}"
}
buildType = buildType.capitalize()
def color = 'good' // Green
if (status.equalsIgnoreCase('aborted')) {
color = '808080' // Grey
} else if (status.equalsIgnoreCase('unstable')) {
color = 'warning' // Orange
} else if (status.equalsIgnoreCase('failed')) {
color = 'danger' // Red
}
def message = """Build ${status} for ${env.DRIVER_DISPLAY_NAME} [${buildType}]
<${env.GITHUB_BRANCH_URL}|${env.BRANCH_NAME}> - <${env.RUN_DISPLAY_URL}|#${env.BUILD_NUMBER}> - <${env.GITHUB_COMMIT_URL}|${env.GIT_SHA}>"""
if (params.CI_SCHEDULE != 'DO-NOT-CHANGE-THIS-SELECTION') {
message += " - ${env.OS_VERSION}"
}
if (!status.equalsIgnoreCase('Started')) {
message += """
${status} after ${currentBuild.durationString - ' and counting'}"""
}
slackSend color: "${color}",
channel: "#cpp-driver-dev-bots",
message: "${message}"
}
}
def submitCIMetrics(buildType) {
long durationMs = currentBuild.duration
long durationSec = durationMs / 1000
long nowSec = (currentBuild.startTimeInMillis + durationMs) / 1000
def branchNameNoPeriods = env.BRANCH_NAME.replaceAll('\\.', '_')
def durationMetric = "okr.ci.cpp.${env.DRIVER_METRIC_TYPE}.${buildType}.${branchNameNoPeriods} ${durationSec} ${nowSec}"
timeout(time: 1, unit: 'MINUTES') {
withCredentials([string(credentialsId: 'lab-grafana-address', variable: 'LAB_GRAFANA_ADDRESS'),
string(credentialsId: 'lab-grafana-port', variable: 'LAB_GRAFANA_PORT')]) {
withEnv(["DURATION_METRIC=${durationMetric}"]) {
sh label: 'Send runtime metrics to labgrafana', script: '''#!/bin/bash -lex
echo "${DURATION_METRIC}" | nc -q 5 ${LAB_GRAFANA_ADDRESS} ${LAB_GRAFANA_PORT}
'''
}
}
}
}
def describePerCommitStage() {
script {
currentBuild.displayName = "Per-Commit build of ${env.BRANCH_NAME}"
currentBuild.description = "Per-Commit build, export validation, unit testing, package building, and testing of installed library for branch ${env.BRANCH_NAME}"
}
}
def describeReleaseAndDeployStage() {
script {
currentBuild.displayName = "Build release v${env.DRIVER_VERSION} [${env.GIT_SHA}]"
currentBuild.description = "Build the DataStax C/C++ driver release v${env.DRIVER_VERSION} [${env.GIT_SHA}] and deploy to Artifactory"
}
}
def describeScheduledAndAdhocTestingStage() {
script {
if (params.CI_SCHEDULE != 'DO-NOT-CHANGE-THIS-SELECTION') {
currentBuild.displayName = "${params.CI_SCHEDULE.toLowerCase().capitalize()} schedule on ${env.OS_VERSION}"
} else {
currentBuild.displayName = "${params.ADHOC_BUILD_AND_EXECUTE_TESTS_SERVER_VERSION} on ${env.OS_VERSION}"
}
def serverVersions = env.SERVER_VERSIONS.split(' ')
def serverDisplayNames = ''
serverVersions.each {
def serverType = it.split('-')[0]
def serverDisplayName = 'Apache Cassandra®'
if (serverType == 'ALL') {
serverDisplayName = "all Apache Cassandra® and DataStax Enterprise server versions"
} else {
def serverVersion = it
try {
serverVersion = it.split('-')[1]
} catch (e) {
;; // no-op
}
if (serverType == 'ddac') {
serverDisplayName = "DataStax Distribution of ${serverDisplayName}"
} else if (serverType == 'dse') {
serverDisplayName = 'DataStax Enterprise'
}
serverDisplayNames += "${serverDisplayName} v${serverVersion}.x"
if (it != serverVersions[-1]) {
serverDisplayNames += ', '
if (it != serverVersions[-2]) {
serverDisplayNames += 'and '
}
}
}
}
currentBuild.description = "Testing ${serverDisplayNames} on ${env.OS_VERSION}"
}
}
def describeScheduledAndAdhocBuildDocuments() {
script {
currentBuild.displayName = "Build documents [${env.GIT_SHA}]"
currentBuild.description = "Build the DataStax C/C++ driver documents [${env.GIT_SHA}]"
}
}
pipeline {
agent none
// Global pipeline timeout
options {
timeout(time: 10, unit: 'HOURS')
buildDiscarder(logRotator(artifactNumToKeepStr: '10', // Keep only the last 10 artifacts
numToKeepStr: '50')) // Keep only the last 50 build records
}
parameters {
choice(
name: 'ADHOC_BUILD_TYPE',
choices: ['BUILD', 'BUILD-AND-EXECUTE-TESTS', 'BUILD-RELEASE-AND-DEPLOY', 'BUILD-DOCUMENTS'],
description: '''Perform a adhoc build operation
<table style="width:100%">
<col width="25%">
<col width="75%">
<tr>
<th align="left">Choice</th>
<th align="left">Description</th>
</tr>
<tr>
<td><strong>BUILD</strong></td>
<td>Performs a <b>Per-Commit</b> build</td>
</tr>
<tr>
<td><strong>BUILD-AND-EXECUTE-TESTS</strong></td>
<td>
Performs a build and executes the integration and unit tests<br/>
<ul>
<li>Use <b>ADHOC_BUILD_AND_EXECUTE_TESTS_SERVER_VERSION</b> to change Apache Cassandra® and DataStax Enterprise selection</li>
<li>Use <b>OS_VERSION</b> to change operating system selection</li>
<li>USE <b>INTEGRATION_TESTS_FILTER</b> to limit integration tests</li>
</ul>
</td>
</tr>
<tr>
<td><strong>BUILD-RELEASE-AND-DEPLOY</strong></td>
<td>Performs a release build and deploys to Artifactory</td>
</tr>
<tr>
<td><strong>BUILD-DOCUMENTS</strong></td>
<td>Performs a document build using documentor</td>
</tr>
</table>
<br/>''')
choice(
name: 'ADHOC_BUILD_AND_EXECUTE_TESTS_SERVER_VERSION',
choices: ['2.1', // Legacy Apache Cassandra®
'2.2', // Legacy Apache Cassandra®
'3.0', // Previous Apache Cassandra®
'3.11', // Current Apache Cassandra®
'4.0', // Development Apache Cassandra®
'ddac-5.1', // Current DataStax Distribution of Apache Cassandra®
'dse-4.8', // Previous EOSL DataStax Enterprise
'dse-5.0', // Long Term Support DataStax Enterprise
'dse-5.1', // Legacy DataStax Enterprise
'dse-6.0', // Previous DataStax Enterprise
'dse-6.7', // Current DataStax Enterprise
'dse-6.8', // Development DataStax Enterprise
'ALL'],
description: '''Apache Cassandra® and DataStax Enterprise server version to use for adhoc <b>BUILD-AND-EXECUTE-TESTS</b> builds
<table style="width:100%">
<col width="15%">
<col width="85%">
<tr>
<th align="left">Choice</th>
<th align="left">Description</th>
</tr>
<tr>
<td><strong>2.1</strong></td>
<td>Apache Cassandra® v2.1.x</td>
</tr>
<tr>
<td><strong>2.2</strong></td>
<td>Apache Cassandra® v2.2.x</td>
</tr>
<tr>
<td><strong>3.0</strong></td>
<td>Apache Cassandra® v3.0.x</td>
</tr>
<tr>
<td><strong>3.11</strong></td>
<td>Apache Cassandra® v3.11.x</td>
</tr>
<tr>
<td><strong>4.0</strong></td>
<td>Apache Cassandra® v4.x (<b>CURRENTLY UNDER DEVELOPMENT</b>)</td>
</tr>
<tr>
<td><strong>ddac-5.1</strong></td>
<td>DataStax Distribution of Apache Cassandra® v5.1.x</td>
</tr>
<tr>
<td><strong>dse-4.8</strong></td>
<td>DataStax Enterprise v4.8.x (<b>END OF SERVICE LIFE</b>)</td>
</tr>
<tr>
<td><strong>dse-5.0</strong></td>
<td>DataStax Enterprise v5.0.x (<b>Long Term Support</b>)</td>
</tr>
<tr>
<td><strong>dse-5.1</strong></td>
<td>DataStax Enterprise v5.1.x</td>
</tr>
<tr>
<td><strong>dse-6.0</strong></td>
<td>DataStax Enterprise v6.0.x</td>
</tr>
<tr>
<td><strong>dse-6.7</strong></td>
<td>DataStax Enterprise v6.7.x</td>
</tr>
<tr>
<td><strong>dse-6.8</strong></td>
<td>DataStax Enterprise v6.8.x (<b>CURRENTLY UNDER DEVELOPMENT</b>)</td>
</tr>
</table>''')
choice(
name: 'OS_VERSION',
choices: ['centos/6-64/cpp',
'centos/7-64/cpp',
'centos/8-64/cpp',
'ubuntu/trusty64/cpp',
'ubuntu/xenial64/cpp',
'ubuntu/bionic64/cpp'],
description: '''Operating system to use for scheduled or adhoc builds
<table style="width:100%">
<col width="20%">
<col width="80%">
<tr>
<th align="left">Choice</th>
<th align="left">Description</th>
</tr>
<tr>
<td><strong>centos/6-64/cpp</strong></td>
<td>CentOS 6 x86_64</td>
</tr>
<tr>
<td><strong>centos/7-64/cpp</strong></td>
<td>CentOS 7 x86_64</td>
</tr>
<tr>
<td><strong>centos/8-64/cpp</strong></td>
<td>CentOS 8 x86_64</td>
</tr>
<tr>
<td><strong>ubuntu/trusty64/cpp</strong></td>
<td>Ubuntu 14.04 LTS x86_64</td>
</tr>
<tr>
<td><strong>ubuntu/xenial64/cpp</strong></td>
<td>Ubuntu 16.04 LTS x86_64</td>
</tr>
<tr>
<td><strong>ubuntu/bionic64/cpp</strong></td>
<td>Ubuntu 18.04 LTS x86_64</td>
</tr>
</table>''')
string(
name: 'INTEGRATION_TESTS_FILTER',
defaultValue: '',
description: '''<p><b>POSITIVE_PATTERNS[-NEGATIVE_PATTERNS]</b></p>
Run only the tests whose name matches one of the positive patterns but none of the negative patterns. <b>\'?\'</b> matches any single character; <b>\'*\'</b> matches any substring; <b>\':\'</b> separates two patterns.''')
string(
name: 'LIBUV_VERSION',
defaultValue: '1.34.0',
description: '''<p>libuv version to build and use</p>
<b>Note:</b> Rarely does this need to change.''')
choice(
name: 'CI_SCHEDULE',
choices: ['DO-NOT-CHANGE-THIS-SELECTION', 'WEEKNIGHTS', 'WEEKENDS', 'MONTHLY'],
description: 'CI testing schedule to execute periodically scheduled builds and tests of the driver (<strong>DO NOT CHANGE THIS SELECTION</strong>)')
string(
name: 'CI_SCHEDULE_SERVER_VERSIONS',
defaultValue: 'DO-NOT-CHANGE-THIS-SELECTION',
description: 'CI testing server version(s) to utilize for scheduled test runs of the driver (<strong>DO NOT CHANGE THIS SELECTION</strong>)')
}
environment {
LIBUV_VERSION = "${params.LIBUV_VERSION}"
CCM_ENVIRONMENT_SHELL = '/usr/local/bin/ccm_environment.sh'
}
stages {
stage('Per-Commit') {
options {
timeout(time: 1, unit: 'HOURS')
}
when {
beforeAgent true
allOf {
expression { params.ADHOC_BUILD_TYPE == 'BUILD' }
expression { params.CI_SCHEDULE == 'DO-NOT-CHANGE-THIS-SELECTION' }
expression { params.CI_SCHEDULE_SERVER_VERSIONS == 'DO-NOT-CHANGE-THIS-SELECTION' }
}
}
matrix {
axes {
axis {
name 'OS_VERSION'
values 'centos/6-64/cpp',
'centos/7-64/cpp',
'centos/8-64/cpp',
'ubuntu/trusty64/cpp',
'ubuntu/xenial64/cpp',
'ubuntu/bionic64/cpp'
}
}
agent {
label "${env.OS_VERSION}"
}
stages {
stage('Initialize-Environment') {
steps {
initializeEnvironment()
script {
if (env.BUILD_STATED_SLACK_NOTIFIED != 'true') {
notifySlack()
}
}
}
}
stage('Describe-Build') {
steps {
describePerCommitStage()
}
}
stage('Install-Dependencies') {
steps {
installDependencies()
}
post {
success {
// Allow empty results for 'osx/high-sierra' which doesn't produce packages
archiveArtifacts artifacts: "${env.OS_DISTRO}/**/libuv*", allowEmptyArchive: true
}
}
}
stage('Build-Driver') {
steps {
buildDriver()
}
post {
success {
archiveArtifacts artifacts: "${env.OS_DISTRO}/**/cassandra-*-tests"
archiveArtifacts artifacts: "${env.OS_DISTRO}/**/dse-*-tests", allowEmptyArchive: true
}
failure {
archiveArtifacts artifacts: "${env.OS_DISTRO}/**/CMakeOutput.log"
archiveArtifacts artifacts: "${env.OS_DISTRO}/**/CMakeError.log"
}
}
}
stage('Validate-Driver-Exports') {
steps {
validateDriverExports()
}
}
stage('Execute-Unit-Tests') {
steps {
configureTestingEnvironment()
executeUnitTests()
}
post {
always {
// Allow empty results if segfault occurs
junit testResults: '*unit-tests-*-results.xml', allowEmptyResults: true
}
}
}
stage('Build-Packages-And-Install-Driver') {
when {
expression { env.OS_VERSION != 'osx/high-sierra' }
}
steps {
buildPackagesAndInstallDriver()
}
post {
success {
archiveArtifacts artifacts: "${env.OS_DISTRO}/**/*-cpp-driver*"
}
}
}
stage('Test-Driver-Installation') {
when {
expression { env.OS_VERSION != 'osx/high-sierra' }
}
steps {
testDriverInstallation()
}
}
}
post {
cleanup {
cleanWs()
}
}
}
post {
always {
node('master') {
submitCIMetrics('commit')
}
}
aborted {
notifySlack('aborted')
}
success {
notifySlack('completed')
}
unstable {
notifySlack('unstable')
}
failure {
notifySlack('FAILED')
}
}
}
stage('Build-Release-And-Deploy') {
options {
timeout(time: 1, unit: 'HOURS')
}
when {
beforeAgent true
anyOf {
buildingTag()
expression { params.ADHOC_BUILD_TYPE == 'BUILD-RELEASE-AND-DEPLOY' }
}
}
matrix {
axes {
axis {
name 'OS_VERSION'
values 'centos/6-64/cpp',
'centos/7-64/cpp',
'centos/8-64/cpp',
'ubuntu/trusty64/cpp',
'ubuntu/xenial64/cpp',
'ubuntu/bionic64/cpp'
}
}
environment {
IS_BUILDING_RELEASE = 'true'
}
agent {
label "${env.OS_VERSION}"
}
stages {
stage('Initialize-Environment') {
steps {
initializeEnvironment()
script {
if (env.BUILD_STATED_SLACK_NOTIFIED != 'true') {
notifySlack()
}
}
}
}
stage('Describe-Release-And-Deploy') {
steps {
describeReleaseAndDeployStage()
}
}
stage('Install-Dependencies') {
steps {
installDependencies()
}
}
stage('Build-Packages-And-Install-Driver') {
steps {
buildPackagesAndInstallDriver()
}
}
stage('Deploy-Driver') {
steps {
deployDriver()
}
}
}
post {
cleanup {
cleanWs()
}
}
}
post {
always {
node('master') {
submitCIMetrics('release')
}
}
aborted {
notifySlack('aborted')
}
success {
notifySlack('completed')
}
unstable {
notifySlack('unstable')
}
failure {
notifySlack('FAILED')
}
}
}
stage('Scheduled-And-Adhoc-Testing') {
when {
beforeAgent true
allOf {
not { buildingTag() }
anyOf {
expression { params.ADHOC_BUILD_TYPE == 'BUILD-AND-EXECUTE-TESTS' }
allOf {
expression { params.ADHOC_BUILD_TYPE == 'BUILD' }
expression { params.CI_SCHEDULE != 'DO-NOT-CHANGE-THIS-SELECTION' }
expression { params.CI_SCHEDULE_SERVER_VERSIONS != 'DO-NOT-CHANGE-THIS-SELECTION' }
}
}
}
}
environment {
CI_INTEGRATION_ENABLED = 'true'
TEST_FILTER = "${params.INTEGRATION_TESTS_FILTER}"
OS_VERSION = "${params.OS_VERSION}"
SERVER_VERSIONS = "${params.CI_SCHEDULE_SERVER_VERSIONS == 'DO-NOT-CHANGE-THIS-SELECTION' ? params.ADHOC_BUILD_AND_EXECUTE_TESTS_SERVER_VERSION : params.CI_SCHEDULE_SERVER_VERSIONS}"
}
matrix {
axes {
axis {
name 'SERVER_VERSION'
values '2.1', // Legacy Apache Cassandra®
'2.2', // Legacy Apache Cassandra®
'3.0', // Previous Apache Cassandra®
'3.11', // Current Apache Cassandra®
'4.0', // Development Apache Cassandra®
'ddac-5.1', // Current DataStax Distribution of Apache Cassandra®
'dse-4.8', // Previous EOSL DataStax Enterprise
'dse-5.0', // Long Term Support DataStax Enterprise
'dse-5.1', // Legacy DataStax Enterprise
'dse-6.0', // Previous DataStax Enterprise
'dse-6.7', // Current DataStax Enterprise
'dse-6.8' // Development DataStax Enterprise
}
}
when {
beforeAgent true
allOf {
expression { return env.SERVER_VERSIONS.split(' ').any { it =~ /(ALL|${env.SERVER_VERSION})/ } }
}
}
agent {
label "${params.OS_VERSION}"
}
stages {
stage('Initialize-Environment') {
steps {
initializeEnvironment()
script {
if (env.BUILD_STATED_SLACK_NOTIFIED != 'true') {
notifySlack()
}
}
}
}
stage('Describe-Build') {
steps {
describeScheduledAndAdhocTestingStage()
}
}
stage('Install-Dependencies') {
steps {
installDependencies()
}
}
stage('Build-Driver') {
steps {
buildDriver()
}
post {
failure {
archiveArtifacts artifacts: "${env.OS_DISTRO}/**/CMakeOutput.log"
archiveArtifacts artifacts: "${env.OS_DISTRO}/**/CMakeError.log"
}
}
}
stage('Execute-Integration-Tests') {
steps {
configureTestingEnvironment()
executeIntegrationTests()
}
post {
always {
// Allow empty results for when segfaults occur
junit testResults: '*integration-tests-*-results.xml', allowEmptyResults: true
}
failure {
archiveArtifacts artifacts: "${env.OS_DISTRO}/**/*-integration-tests-driver-logs.tgz"
}
cleanup {
cleanWs()
}
}
}
}
}
post {
aborted {
notifySlack('aborted')
}
success {
notifySlack('completed')
}
unstable {
notifySlack('unstable')
}
failure {
notifySlack('FAILED')
}
}
}
stage('Scheduled-And-Adhoc-Build-Documents') {
when {
beforeAgent true
allOf {
not { buildingTag() }
anyOf {
allOf {
// User initiated
expression { params.ADHOC_BUILD_TYPE == 'BUILD-DOCUMENTS' }
expression { params.CI_SCHEDULE == 'DO-NOT-CHANGE-THIS-SELECTION' }
expression { params.CI_SCHEDULE_SERVER_VERSIONS == 'DO-NOT-CHANGE-THIS-SELECTION' }
}
allOf {
// Schedule initiated
branch 'master'
expression { params.ADHOC_BUILD_TYPE == 'BUILD-DOCUMENTS' }
expression { params.CI_SCHEDULE == 'WEEKENDS' }
expression { params.CI_SCHEDULE_SERVER_VERSIONS == 'DO-NOT-CHANGE-THIS-SELECTION' }
}
}
}
}
environment {
OS_VERSION = 'ubuntu/bionic64/cpp'
}
agent {
label 'ubuntu/bionic64/cpp'
}
stages {
stage('Initialize-Environment') {
steps {
initializeEnvironment()
script {
notifySlack()
}
}
}
stage('Describe-Build') {
steps {
describeScheduledAndAdhocBuildDocuments()
}
}
stage('Build-Documents') {
steps {
buildDocuments()
}
post {
success {
archiveArtifacts artifacts: '*-documents.tgz'
}
}
}
}
post {
aborted {
notifySlack('aborted')
}
success {
notifySlack('completed')
}
unstable {
notifySlack('unstable')
}
failure {
notifySlack('FAILED')
}
}
}
}
}