/
evergreen.yml
12360 lines (11481 loc) · 420 KB
/
evergreen.yml
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
#####################################################
# A note on expansions #
#####################################################
# Expansions usually appear in the form ${key|default}
# If 'key' is found in the executor's map of currently known
# expansions, the corresponding value is used. If the key can
# not be found, the default is used.
#
# Arbitrary expansions can be specified in the YAML configuration
# files in the following places:
# - The 'expansions' field for buildvariants (branch file)
# - The 'expansions' field for distros (distros file)
#
# A number of 'built-in' expansions are also available for use; these include:
# - environment variables available on the host machine
# - 'workdir' (references the executor's work directory).
# - 'task_id' (references the task id of the task the executor is working on).
# - 'build_variant' (references the executing task's buildvariant).
# - 'config_root' (references the root directory for the executor's configuration artifacts).
stepback: true
command_type: system
# Files that match an ignore-list pattern will not trigger a build, if they're the only modified
# files in the patch.
ignore:
- ".*"
- "!.clang-format"
- "!.eslintrc.yml"
- "*.md"
- "*.rst"
- "*.txt"
- "/distsrc/**"
- "/docs/**"
- "/etc/*.yml"
- "!/etc/evergreen.yml"
- "README"
## Some variables for convenience:
variables:
# Used when the tests it runs depend only on mongod, mongos, the mongo shell and the tools.
- &task_template
name: template
depends_on:
- name: compile
commands:
- func: "do setup"
- func: "run tests"
vars:
resmoke_args: --help
resmoke_jobs_max: 0 # No cap on number of jobs.
# Used for tests that invoke resmoke.py and require no additional setup.
- &task_depending_on_all_template
<<: *task_template
depends_on:
- name: compile_all
- &benchmark_template
name: benchmark_template
depends_on:
- name: compile_benchmarks
commands:
- func: "do benchmark setup"
- func: "run tests"
vars:
resmoke_args: --help
resmoke_jobs_max: 1
- func: "send benchmark results"
- &benchrun_embedded_template
name: benchrun_embedded_template
depends_on:
- generate_benchrun_embedded_files
commands:
- func: "do benchmark embedded setup"
- func: "run tests"
vars:
resmoke_args: --help
resmoke_jobs_max: 1
- func: "send benchmark results"
- &jepsen_config_vars
jepsen_key_time_limit: --key-time-limit 15
jepsen_protocol_version: --protocol-version 1
jepsen_read_concern: ""
jepsen_read_with_find_and_modify: ""
jepsen_storage_engine: ""
jepsen_test_name: ""
# Empirically, we've had greater success in reproducing the issues found in MongoDB versions
# 3.4.0-rc3 and 3.4.0-rc4 when running Jepsen with at least --time-limit=600.
jepsen_time_limit: --time-limit 1200
jepsen_write_concern: ""
# Template for running Jepsen tests
- &run_jepsen_template
name: run_jepsen_template
depends_on:
- name: compile
commands:
- func: "do setup"
- func: "do jepsen setup"
- func: "run jepsen test"
vars:
<<: *jepsen_config_vars
- &jstestfuzz_config_vars
num_files: 15
num_tasks: 10
resmoke_args: --help # resmoke_args needs to be overridden to specify one of the jstestfuzz suites
resmoke_jobs_max: 1
should_shuffle: false
continue_on_failure: false
# Terminate the function when there has been no output to stdout for 30 minutes. E.g. when something is stuck in an infinite loop.
# resmoke.py writes the test output to logkeeper and only writes to stdout when starting the next test.
# resmoke.py not producing output on stdout means that the test is still running and presumably not going to finish.
# Note that timeout_secs is different from exec_timeout_secs, which applies to a task and times out regardless of whether output has been written to stdout.
timeout_secs: 1800
# Used for tests that invoke 'resmoke.py --suites=jstestfuzz*'.
- &jstestfuzz_template
name: jstestfuzz_template
exec_timeout_secs: 14400 # Time out the task if it runs for more than 4 hours.
depends_on: []
commands:
- func: "generate fuzzer tasks"
# Templates used by powercycle
- &powercycle_remote_credentials
private_key_file: $(${posix_workdir})/powercycle.pem
private_key_remote: ${powercycle_private_key}
aws_key_remote: ${powercycle_aws_key}
aws_secret_remote: ${powercycle_aws_secret}
- &powercycle_ec2_instance
aws_ec2_yml: aws_ec2.yml
ec2_expire_hours: "24"
ec2_monitor_files: proc.json system.json
monitor_proc_file: proc.json
monitor_system_file: system.json
remote_dir: /log/powercycle
secret_port: "20001"
security_group_ids: ${powercycle_aws_security_group_id}
security_groups: mci powercycle_testing
subnet_id: ${powercycle_aws_subnet_id}
ssh_identity: -i ${private_key_file}
ssh_key_id: ${powercycle_ssh_key_id}
standard_port: "20000"
virtualenv_dir: venv_powercycle
windows_crash_cmd: \"notmyfault/notmyfaultc64.exe -accepteula crash 1\"
windows_crash_dl: https://download.sysinternals.com/files/NotMyFault.zip
windows_crash_dir: notmyfault
windows_crash_zip: notmyfault.zip
- &powercycle_expansions
params:
updates:
- key: backup_path_after
value: ${remote_dir}/afterrecovery
- key: backup_path_before
value: ${remote_dir}/beforerecovery
- key: backup_artifacts
value: ${remote_dir}/afterrecovery* ${remote_dir}/beforerecovery*
- key: db_path
value: /data/db
- key: log_path
value: ${remote_dir}/mongod.log
- key: exit_file
value: powercycle_exit.yml
- &powercycle_test
ec2_artifacts: ${log_path} ${db_path} ${backup_artifacts}
program_options: --exitYamlFile=${exit_file} --logLevel=info --backupPathBefore=${backup_path_before} --backupPathAfter=${backup_path_after}
connection_options: --sshUserHost=${private_ip_address} --sshConnection=\"${ssh_identity} ${ssh_connection_options}\"
test_options: --testLoops=15 --seedDocNum=10000 --rsync --rsyncExcludeFiles=diagnostic.data/metrics.interim* --validate=local --canary=local
crash_options: --crashMethod=internal --crashOption=${windows_crash_cmd} --crashWaitTime=45 --jitterForCrashWaitTime=5 --instanceId=${instance_id}
client_options: --numCrudClients=20 --numFsmClients=20
mongodb_options: --rootDir=${remote_dir}-${task_id} --mongodbBinDir=${remote_dir}
mongod_options: --mongodUsablePorts ${standard_port} ${secret_port} --dbPath=${db_path} --logPath=${log_path}
mongod_extra_options: --mongodOptions=\"--setParameter enableTestCommands=1 --setParameter logComponentVerbosity='{storage:{recovery:2}}'\"
- &benchrun_embedded
name: benchrun_embedded
execution_tasks:
- benchrun_embedded_aggregation
- benchrun_embedded_commands
- benchrun_embedded_insert
- benchrun_embedded_misc
- benchrun_embedded_mixed_and_multi
- benchrun_embedded_queries
- benchrun_embedded_remove
- benchrun_embedded_update
- generate_benchrun_embedded_files
- &unittests
name: unittests!
execution_tasks:
- compile_unittests
- unittests
- &dbtest
name: dbtest!
execution_tasks:
- compile_dbtest
- dbtest
- &compile_task_group_template
name: compile_task_group_template
max_hosts: 1
tasks: []
setup_task:
- func: "apply compile expansions"
- func: "set task expansion macros"
teardown_task:
- func: "attach scons config log"
- func: "attach report"
- func: "attach artifacts"
- func: "kill processes"
- func: "save code coverage data"
- func: "save mongo coredumps"
- func: "save failed unittests"
- func: "save unstripped dbtest"
- func: "save hang analyzer debugger files"
- func: "save disk statistics"
- func: "save system resource information"
- func: "remove files"
vars:
files: >-
src/resmoke_error_code
src/build/scons/config.log
src/*.gcda.gcov
src/gcov-intermediate-files.tgz
src/*.core src/*.mdmp
mongo-coredumps.tgz
src/unittest_binaries/*_test${exe}
mongo-unittests.tgz
src/debugger*.*
src/mongo-hanganalyzer.tgz
diskstats.tgz
system-resource-info.tgz
${report_file|src/report.json}
${archive_file|src/archive.json}
setup_group_can_fail_task: true
setup_group:
- func: "kill processes"
- func: "cleanup environment"
- func: "clear OOM messages"
- command: manifest.load
- func: "git get project"
- func: "get all modified patch files"
- func: "set task expansion macros"
# The python virtual environment is installed in ${workdir}, which is created in
# "set up virtualenv".
- func: "set up virtualenv"
# NOTE: To disable the compile bypass feature, comment out the next line.
#
- func: "bypass compile and fetch binaries"
- func: "update bypass expansions"
- func: "get buildnumber"
- func: "set up credentials"
- func: "fetch and build OpenSSL"
- func: "use WiredTiger develop" # noop if ${use_wt_develop} is not "true"
- func: "set up win mount script"
- func: "generate compile expansions"
teardown_group:
- func: "scons cache pruning"
- func: "umount shared scons directory"
- func: "print OOM messages"
- func: "cleanup environment"
timeout:
- func: "run hang analyzer"
# Use this template for enterprise Windows testing coverage on non-pushing
# variants
- &enterprise-windows-64-2k8-nopush-template
name: enterprise-windows-64-2k8-nopush-template
run_on:
- windows-64-vs2017-test
modules:
- enterprise
display_tasks:
- *dbtest
- *unittests
expansions: &enterprise-windows-64-2k8-nopush-expansions-template
platform_decompress: unzip
exe: ".exe"
msi_target: msi
content_type: application/zip
compile_flags: --release --ssl MONGO_DISTMOD=windows-64 CPPPATH="c:/sasl/include c:/snmp/include" LIBPATH="c:/sasl/lib c:/snmp/lib" -j$(( $(grep -c ^processor /proc/cpuinfo) / 2 )) --win-version-min=ws08r2
# We invoke SCons using --jobs = (# of CPUs / 4) to avoid causing out of memory errors due to
# spawning a large number of linker processes.
num_scons_link_jobs_available: $(( $(grep -c ^processor /proc/cpuinfo) / 4 ))
python: '/cygdrive/c/python/python37/python.exe'
ext: zip
use_scons_cache: true
multiversion_platform: windows
multiversion_edition: enterprise
tooltags: "ssl sasl gssapi"
build_mongoreplay: false
jstestfuzz_num_generated_files: 35
large_distro_name: windows-64-vs2017-compile
tasks:
- name: compile_all_run_unittests_TG
requires:
- name: burn_in_tests_gen
distros:
- windows-64-vs2017-compile
- name: compile_benchmarks
distros:
- windows-64-vs2017-compile
- name: burn_in_tests_gen
- name: .aggfuzzer .common
- name: audit
- name: auth_audit_gen
- name: .benchmarks
- name: buildscripts_test
- name: causally_consistent_jscore_txns_passthrough
- name: .encrypt !.aggregation !.gcm
- name: external_auth
distros:
- windows-64-2016
- name: .jscore .common !.compat !.sharding
- name: .jstestfuzz .common
- name: .logical_session_cache
- name: replica_sets_auth_gen
- name: sasl
- name: sharding_auth_gen
- name: sharding_auth_audit_gen
- name: snmp
- &stitch_support_task_group_template
name: stitch_support_task_group_template
setup_task:
- func: "apply compile expansions"
- func: "set task expansion macros"
teardown_task:
setup_group_can_fail_task: true
setup_group:
- func: "kill processes"
- func: "cleanup environment"
- command: manifest.load
- func: "git get project"
- func: "set task expansion macros"
- func: "set up virtualenv"
- func: "get buildnumber"
- func: "set up win mount script"
- func: "generate compile expansions"
teardown_group:
- func: "scons cache pruning"
- func: "umount shared scons directory"
# List of all variants that make mongocryptd
# If a variant is listed here and has a push task, mongocryptd is pushed
- mongocryptd_variants: &mongocryptd_variants
- enterprise-amazon2
- enterprise-debian92-64
- enterprise-linux-64-amazon-ami
- enterprise-macos
- enterprise-macos-openssl
- enterprise-rhel-62-64-bit
- enterprise-rhel-62-64-bit-coverage
- enterprise-rhel-62-64-bit-inmem
- enterprise-rhel-62-64-bit-flow-control-off
- enterprise-rhel-62-64-bit-majority-read-concern-off
- enterprise-rhel-62-64-bit-multi-txn-oplog-entries
- enterprise-rhel-62-64-bit-required-inmem
- enterprise-rhel-62-64-bit-required-majority-read-concern-off
- enterprise-rhel-67-s390x
- enterprise-rhel-70-64-bit
- enterprise-rhel-70-64-bit-kitchen-sink
- enterprise-rhel-71-ppc64le
- enterprise-rhel-71-ppc64le-inmem
- enterprise-rhel-72-s390x
- enterprise-rhel-72-s390x-inmem
- enterprise-suse12-64
- enterprise-suse15-64
- enterprise-suse12-s390x
- enterprise-ubuntu-dynamic-1604-64-bit
- enterprise-ubuntu-dynamic-1604-clang
- enterprise-ubuntu1604-64
- enterprise-ubuntu1604-arm64
- enterprise-ubuntu1604-s390x
- enterprise-ubuntu1804-64
- enterprise-ubuntu1804-arm64
- enterprise-ubuntu1804-ppc64le
- enterprise-ubuntu1804-s390x
- enterprise-windows-64-2k8
- enterprise-windows-64-2k8-async
- enterprise-windows-64-2k8-compile-all
- enterprise-windows-64-2k8-debug-unoptimized
- enterprise-windows-64-2k8-inmem
- enterprise-windows-64-2k8-nopush-template
- enterprise-windows-64-2k8-openssl
- enterprise-windows-64-2k8-required
- enterprise-windows-64-2k8-wtdevelop
- ubuntu1804-debug-asan
- ubuntu1804-debug-ubsan
- ubuntu1804-debug-aubsan-lite
- ubuntu1804-debug-aubsan-async
# List of all variants that make mh artifacts.
# If a variant is listed here and has a push task, the mh artifacts are pushed
- mh_variants: &mh_variants
- enterprise-debian92-64
- enterprise-macos
- enterprise-rhel-62-64-bit
- enterprise-rhel-70-64-bit
- enterprise-windows-64-2k8
#######################################
# Functions #
#######################################
functions:
"remove files": &remove_files
command: shell.exec
params:
script: |
if [ -z "${files}" ]; then
exit 0
fi
for file in ${files}
do
if [ -f "$file" ]; then
echo "Removing file $file"
rm -f $file
fi
done
"configure evergreen api credentials": &configure_evergreen_api_credentials
command: shell.exec
type: test
params:
working_dir: src
silent: true
script: |
# Create the Evergreen API credentials
cat > .evergreen.yml <<END_OF_CREDS
api_server_host: https://evergreen.mongodb.com/api
api_key: "${evergreen_api_key}"
user: "${evergreen_api_user}"
END_OF_CREDS
"git get project": &git_get_project
command: git.get_project
params:
directory: ${git_project_directory|src}
revisions: # for each module include revision as <module_name> : ${<module_name>_rev}
enterprise: ${enterprise_rev}
wtdevelop: ${wtdevelop_rev}
"fetch artifacts": &fetch_artifacts
command: s3.get
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
remote_file: ${project}/${build_variant}/${revision}/artifacts/${build_id}.tgz
bucket: mciuploads
extract_to: src
"fetch binaries": &fetch_binaries
command: s3.get
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
remote_file: ${mongo_binaries}
bucket: mciuploads
local_file: src/mongo-binaries.tgz
"extract binaries": &extract_binaries
command: shell.exec
params:
working_dir: src
script: |
set -o errexit
${decompress} mongo-binaries.tgz
cp mongodb*/bin/* .
"check binary version": &check_binary_version
command: shell.exec
params:
working_dir: src
script: |
set -o errexit
mongo_binary=$(find mongodb*/bin -name mongo${exe})
# There should only be one mongo shell
if [ $(echo $mongo_binary | wc -w) -ne 1 ]; then
echo "There is more than 1 extracted mongo binary: $mongo_binary"
exit 1
fi
# For compile bypass we need to skip the binary version check since we can tag a commit
# after the base commit binaries were created. This would lead to a mismatch of the binaries
# and the version from git describe --abbrev=7 in the compile_expansions.yml.
if [ "${is_patch}" = "true" ] && [ "${bypass_compile|false}" = "true" ]; then
echo "Skipping binary version check since we are bypassing compile in this patch build."
exit 0
fi
${activate_virtualenv}
bin_ver=$($python -c "import yaml; print(yaml.safe_load(open('compile_expansions.yml'))['version']);" | tr -d '[ \r\n]')
# Due to SERVER-23810, we cannot use $mongo_binary --quiet --nodb --eval "version();"
mongo_ver=$($mongo_binary --version | perl -pe '/version v(.*)$/; $_ = $1;' | tr -d '[ \r\n]')
# The versions must match
if [ "$bin_ver" != "$mongo_ver" ]; then
echo "The mongo version is $mongo_ver, expected version is $bin_ver"
exit 1
fi
"fetch benchmarks": &fetch_benchmarks
command: s3.get
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
remote_file: ${project}/${build_variant}/${revision}/benchmarks/${build_id}.tgz
bucket: mciuploads
extract_to: src
"fetch benchrun embedded files": &fetch_benchrun_embedded_files
command: s3.get
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
remote_file: ${project}/${build_variant}/${revision}/benchrun_json_files.tgz
bucket: mciuploads
extract_to: src/benchrun_embedded/testcases
"get buildnumber": &get_buildnumber
command: keyval.inc
params:
key: "${build_variant}_master"
destination: "builder_num"
"run diskstats": &run_diskstats
command: shell.exec
params:
background: true
system_log: true
script: |
set -o errexit
set -o verbose
# On Windows we can use typeperf.exe to dump performance counters.
if [ "Windows_NT" = "$OS" ]; then
typeperf -qx PhysicalDisk | grep Disk | grep -v _Total > disk_counters.txt
typeperf -cf disk_counters.txt -si 5 -o mongo-diskstats
# Linux: iostat -t option for timestamp.
elif iostat -tdmx > /dev/null 2>&1; then
iostat -tdmx 5 > mongo-diskstats
# OSX: Simulate the iostat timestamp.
elif iostat -d > /dev/null 2>&1; then
iostat -d -w 5 | while IFS= read -r line; do printf '%s %s\n' "$(date +'%m/%d/%Y %H:%M:%S')" "$line" >> mongo-diskstats; done
# Check if vmstat -t is available.
elif vmstat -td > /dev/null 2>&1; then
vmstat -td 5 > mongo-diskstats
# Check if vmstat -T d is available.
elif vmstat -T d > /dev/null 2>&1; then
vmstat -T d 5 > mongo-diskstats
else
printf "Cannot collect mongo-diskstats on this platform\n"
fi
"collect system resource info": &collect_system_resource_info
command: shell.exec
params:
working_dir: src
background: true
system_log: true
script: |
${activate_virtualenv}
$python buildscripts/collect_resource_info.py -o system_resource_info.json -i 5
# Run a monitor process as a background, system task to periodically
# display how many threads interesting processes are using.
"monitor process threads": &monitor_process_threads
command: shell.exec
params:
background: true
system_log: true
script: |
proc_list="(bsondump|java|lein|mongo|python|_test$|_test\.exe$)"
if [ "Windows_NT" = "$OS" ]; then
get_pids() {
proc_pids=$(tasklist /fo:csv |
awk -F'","' '{x=$1; gsub("\"","",x); print $2, x}' |
grep -iE $1 |
cut -f1 -d ' ');
}
get_process_info() {
proc_name="";
proc_info=$(wmic process where "ProcessId=\"$1\"" get "Name,ProcessId,ThreadCount" /format:csv 2> /dev/null | grep $1);
if [ ! -z $proc_info ]; then
proc_name=$(echo $proc_info | cut -f2 -d ',');
proc_threads=$(echo $proc_info | cut -f4 -d ',');
fi;
}
else
get_pids() { proc_pids=$(pgrep $1); }
get_process_info() {
proc_name=$(ps -p $1 -o comm=);
# /proc is available on Linux platforms
if [ -f /proc/$1/status ]; then
${set_sudo}
proc_threads=$($sudo grep Threads /proc/$1/status | sed "s/\s//g" | cut -f2 -d ":");
else
proc_threads=$(ps -AM $1 | grep -vc PID);
fi;
}
fi
while [ 1 ]
do
get_pids $proc_list
if [ ! -z "$proc_pids" ]; then
printf "Running process/thread counter\n"
printf "PROCESS\tPID\tTHREADS\n"
fi
for pid in $proc_pids
do
get_process_info $pid
if [ ! -z "$proc_name" ]; then
printf "$proc_name\t$pid\t$proc_threads\n"
fi
done
sleep 60
done
"set up credentials": &set_up_credentials
command: shell.exec
params:
working_dir: src
silent: true
script: |
cat > mci.buildlogger <<END_OF_CREDS
slavename='${slave}'
passwd='${passwd}'
builder='MCI_${build_variant}'
build_num=${builder_num}
build_phase='${task_name}_${execution}'
END_OF_CREDS
"set up win mount script": &set_up_win_mount_script
command: shell.exec
params:
working_dir: src
shell: bash
silent: true
script: |
cat <<EOF > win_mount.sh
net use X: '\\\\${win_scons_endpoint}\\share' /USER:${win_scons_user} '${win_scons_pass}'
EOF
chmod +x win_mount.sh
"set up notary client credentials": &set_up_notary_client_credentials
command: shell.exec
params:
working_dir: src
silent: true
script: |
set -o errexit
cat <<EOF > notary_env.sh
export NOTARY_TOKEN=${signing_auth_token_44}
EOF
echo "${signing_auth_token_44}" > signing_auth_token
"set up remote credentials": &set_up_remote_credentials
command: shell.exec
params:
silent: true
script: |
set -o errexit
# Since the macros 'private_key_remote' and 'private_key_file' are not always defined
# we default to /dev/null to avoid syntax errors of an empty expansion.
if [ ! -z "${private_key_remote}" ] && [ ! -z "${private_key_file}" ] ; then
mkdir -p ~/.ssh
echo -n "${private_key_remote}" > ${private_key_file|/dev/null}
chmod 0600 ${private_key_file|/dev/null}
fi
# Ensure a clean aws configuration state
rm -rf ~/.aws
mkdir -p ~/.aws
# If ${aws_profile_remote} is not specified then the config & credentials are
# stored in the 'default' profile.
aws_profile="${aws_profile_remote|default}"
# The profile in the config file is specified as [profile <profile>], except
# for [default], see http://boto3.readthedocs.io/en/latest/guide/configuration.html
if [ $aws_profile = "default" ] ; then
aws_profile_config="[default]"
else
aws_profile_config="[profile $aws_profile]"
fi
cat <<EOF >> ~/.aws/config
$aws_profile_config
region = us-east-1
EOF
# The profile in the credentials file is specified as [<profile>].
cat <<EOF >> ~/.aws/credentials
[$aws_profile]
aws_access_key_id = ${aws_key_remote}
aws_secret_access_key = ${aws_secret_remote}
EOF
cat <<EOF > ~/.boto
[Boto]
https_validate_certificates = False
EOF
"call BF Suggestion service":
command: shell.exec
params:
working_dir: src
shell: bash
silent: true
script: |
report_file="report.json"
# Check if the report file exists and has failures.
if [ -f $report_file ] && grep -Eq "\"failures\": [1-9]" $report_file; then
# Calling the BF Suggestion server endpoint to start feature extraction.
payload="{\"task_id\": \"${task_id}\", \"execution\": ${execution}}"
echo "Sending task info to the BF suggestion service"
# The --user option is passed through stdin to avoid showing in process list.
user_option="--user ${bfsuggestion_user}:${bfsuggestion_password}"
curl --header "Content-Type: application/json" \
--data "$payload" \
--max-time 10 \
--silent \
--show-error \
--config - \
https://bfsuggestion.corp.mongodb.com/tasks <<< $user_option
echo "Request to BF Suggestion service status: $?"
fi
"upload debugsymbols": &upload_debugsymbols
command: s3.put
params:
optional: true
aws_key: ${aws_key}
aws_secret: ${aws_secret}
local_file: src/mongo-debugsymbols.tgz
remote_file: ${mongo_debugsymbols}
bucket: mciuploads
permissions: public-read
content_type: ${content_type|application/gzip}
"fetch debugsymbols archive": &fetch_debugsymbols_archive
command: s3.get
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
remote_file: ${mongo_debugsymbols}
bucket: mciuploads
local_file: src/mongo-debugsymbols.tgz
"extract debugsymbols": &extract_debugsymbols
command: shell.exec
params:
working_dir: src
script: |
set -o errexit
set -o verbose
# Debug symbols are not created for every variant
if [ ! -f mongo-debugsymbols.tgz ]; then
exit
fi
${decompress} mongo-debugsymbols.tgz
files="mongo mongod mongos"
file_exts="debug dSYM pdb"
for file_ext in $file_exts
do
for file in $files
do
mv mongodb*/$file.$file_ext . 2>/dev/null || true
done
rm -r mongodb*/*.$file_ext 2>/dev/null || true
done
rm mongo-debugsymbols.tgz 2>/dev/null || true
"fetch and build OpenSSL":
command: shell.exec
params:
working_dir: src
script: |
set -o errexit
set -o verbose
if [ "${build_openssl|}" = "true" ]; then
bash buildscripts/fetch_and_build_openssl.sh "${python|python3}" "${openssl_make_flags|}" "${openssl_config_flags|}"
fi
"use WiredTiger develop":
command: shell.exec
params:
working_dir: src
script: |
set -o errexit
set -o verbose
if [ "${use_wt_develop|}" = "true" ]; then
cd src/third_party
for wtdir in dist examples ext lang src test tools ; do
rm -rf wiredtiger/$wtdir
mv wtdevelop/$wtdir wiredtiger/
done
fi
"setup gradle signing keys":
command: shell.exec
params:
silent: true
shell: bash
script: |
cd src/src/mongo/embedded/mongo_embedded/java
echo '${mongodb_mobile_release_secring}' | base64 -d > embedded-android/secring.gpg
cat <<EOF > local.properties
signing.keyId=${mongodb_mobile_release_signing_keyid}
signing.password=${mongodb_mobile_release_signing_password}
signing.secretKeyRingFile=${mongodb_mobile_release_signing_secretkeyringfile}
ossrhUsername=${mongodb_mobile_ossrh_username}
ossrhPassword=${mongodb_mobile_ossrh_password}
EOF
cat <<EOF > artifactory_mobile_creds.sh
export artifactory_mobile_user=${artifactory_mobile_user}
export artifactory_mobile_pass=${artifactory_mobile_pass}
EOF
"setup android toolchain":
command: shell.exec
params:
script: |
set -o errexit
set -o verbose
if [ "${setup_android_toolchain|}" = "true" ]; then
${activate_virtualenv}
PYTHON=$python ${compile_env|} src/buildscripts/setup-android-toolchain.sh $(pwd)/android_sdk
fi
"build java embedded sdk":
command: shell.exec
params:
shell: bash
script: |
set -o errexit
set -o verbose
# If the android toolchain has not been setup the android sdk will not
# be available and we should not build the android version of mongodb
# embedded.
if [ "${setup_android_toolchain|}" != "true" ]; then
echo "Android toolchain has not been setup, skipping \"build java embedded sdk\""
exit 0
fi
export ANDROID_HOME=$(pwd)/android_sdk
MINOR_VER=$(echo "${version}" | awk -F. '{print $(NF-1)}')
if [ $(($MINOR_VER % 2)) != 0 ]; then
EMBEDDED_RELEASE_VERSION="${version}-SNAPSHOT"
else
EMBEDDED_RELEASE_VERSION="${version}"
fi
cd src/src/mongo/embedded/mongo_embedded/java
# TODO: Clean this up later where we can remove duplication
if [ "${package_type|embedded-android}" = "embedded-jar" ]; then
tar zxvf ../../../../../../embedded-sdk-java-linux-x86-64.tgz
mkdir -p jniLibs/linux-x86-64
cp ./mongo-embedded-sdk-${version}/lib/libmongo_embedded.so jniLibs/linux-x86-64
rm -rf ./mongo-embedded-sdk-${version}
tar zxvf ../../../../../../embedded-sdk-java-darwin.tgz
mkdir -p jniLibs/darwin
cp ./mongo-embedded-sdk-${version}/lib/libmongo_embedded.dylib jniLibs/darwin
rm -rf ./mongo-embedded-sdk-${version}
./gradlew clean :embedded-jar:build :embedded-jar:publishMavenPublicationToLocalRepository
mkdir -p ../../../../../build/mongo-embedded-sdk-$EMBEDDED_RELEASE_VERSION/java
cp -r embedded-jar/build/repo/* ../../../../../build/mongo-embedded-sdk-$EMBEDDED_RELEASE_VERSION/java
else
for arch in arm64-v8a armeabi-v7a x86_64 ; do
tar zxvf ../../../../../../embedded-sdk-android-$arch.tgz
mkdir -p jniLibs/$arch
cp ./mongo-embedded-sdk-${version}/lib/libmongo_embedded.so jniLibs/$arch
rm -rf ./mongo-embedded-sdk-${version}
done
./gradlew clean :embedded-android:build
# Is this a release?
if [ "${is_release|false}" = "true" ]; then
./gradlew :embedded-android:uploadArchives closeAndReleaseRepository
fi
mkdir -p ../../../../../build/mongo-embedded-sdk-$EMBEDDED_RELEASE_VERSION/android
cp -r embedded-android/build/outputs/aar/* ../../../../../build/mongo-embedded-sdk-$EMBEDDED_RELEASE_VERSION/android
fi
"shared scons cache pruning":
command: shell.exec
type: system
params:
shell: bash
working_dir: src
script: |
set -o errexit
set -o verbose
# removes files from the shared scons cache.
# Only prune on master branch
if [[ "${project}" == "mongodb-mongo-master" ]]; then
set +o errexit
if [ "Windows_NT" = "$OS" ]; then
./win_mount.sh
else
mount | grep "\/efs" > /dev/null
fi
if [ $? -eq 0 ]; then
echo "Shared cache is already mounted"
else
echo "Shared cache - mounting file system"
if [ "Windows_NT" = "$OS" ]; then
./win_mount.sh
else
sudo mount /efs
fi
fi
set -o errexit
if [ "Windows_NT" = "$OS" ]; then
cache_folder=/cygdrive/x
else
cache_folder=/efs
fi
dirs=$(ls -l $cache_folder | grep -v total | awk '{print $NF}')
echo "Pruning shared SCons directories"
for dir in $dirs; do
echo "Pruning $cache_folder/$dir/scons-cache"
if [ -e $cache_folder/$dir/info/distro_name ]; then
distro=$(cat $cache_folder/$dir/info/distro_name)
fi
# Set cache sizes by distro
case $distro in
ubuntu1604|ubuntu1804|rhel62|rhel70)
cache_size=600
;;
*)
# default
cache_size=400
;;
esac
if [ "Windows_NT" = "$OS" ]; then
echo "dir="$dir
python buildscripts/scons_cache_prune.py --cache-dir x:/$dir/scons-cache --cache-size $cache_size --prune-ratio 1.0
else
sudo python buildscripts/scons_cache_prune.py --cache-dir /efs/$dir/scons-cache --cache-size $cache_size --prune-ratio 1.0
fi
echo ""
done
if [ "Windows_NT" = "$OS" ]; then
net use X: /delete || true
else
sudo umount /efs || true
fi
else
echo "Not on master, shared SCons cache pruning skipped"
fi
"scons cache pruning":
command: shell.exec
params:
working_dir: src
script: |
set -o errexit
set -o verbose
# removes files from the local scons cache.
${activate_virtualenv}
echo "Legacy local shared cache prune"
if [ -d "${scons_cache_path}" ]; then
$python buildscripts/scons_cache_prune.py --cache-dir ${scons_cache_path} --cache-size ${scons_cache_size|200} --prune-ratio ${scons_prune_ratio|0.8}
fi