forked from mongodb/mongo-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
common.yml
2410 lines (2257 loc) · 65.7 KB
/
common.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
#######################################
# Tools Driver Config for MCI #
#######################################
# default command type
command_type: system
# run the same task in the previous revision if the current task fails
stepback: true
variables:
# Common mongodb arguments
mongod_arguments:
default: &mongod_default_startup_args
mongod_args: ""
mongod_port: 33333
ssl: &mongod_ssl_startup_args
mongod_args: "--sslMode requireSSL --sslCAFile common/db/testdata/ca-ia.pem --sslPEMKeyFile common/db/testdata/test-server.pem"
replsettest_ssl_config: "sslMode: \\\"requireSSL\\\",sslPEMKeyFile: \\\"common/db/testdata/test-server.pem\\\", sslCAFile: \\\"common/db/testdata/ca-ia.pem\\\", sslAllowInvalidHostnames: \\\"\\\""
mongod_port: 33333
tls: &mongod_tls_startup_args
mongod_args_tls: "--tlsMode requireTLS --tlsCAFile common/db/testdata/ca-ia.pem --tlsCertificateKeyFile common/db/testdata/test-server.pem"
replsettest_tls_config: "tlsMode: \\\"requireTLS\\\",tlsCertificateKeyFile: \\\"common/db/testdata/test-server.pem\\\", tlsCAFile: \\\"common/db/testdata/ca-ia.pem\\\", tlsAllowInvalidHostnames: \\\"\\\""
mongod_port: 33333
mongo_arguments:
default: &mongo_default_startup_args
mongo_args: &mongo_default_startup_args_string "--port 33333"
mongod_port: 33333
ssl: &mongo_ssl_startup_args
mongo_args: "--port 33333 --ssl --sslCAFile common/db/testdata/ca-ia.pem --sslPEMKeyFile common/db/testdata/test-server.pem --sslAllowInvalidCertificates"
mongod_port: 33333
tls: &mongo_tls_startup_args
mongo_args_tls: "--port 33333 --tls --tlsCAFile common/db/testdata/ca-ia.pem --tlsCertificateKeyFile common/db/testdata/test-server.pem --tlsAllowInvalidCertificates"
mongod_port: 33333
functions:
"run legacy tests":
command: shell.exec
type: test
params:
working_dir: src/github.com/mongodb/mongo-tools
script: |
set -x
set -v
set -e
chmod +x bin/*
mv bin/* ${test_path}/
cd ${test_path}
./mongo --nodb jstests/tool/*.js
"run qa-tests":
command: shell.exec
type: test
params:
working_dir: src/github.com/mongodb/mongo-tools
script: |
set -x
set -v
set -e
chmod +x bin/*
mv bin/* test/qa-tests/
cd test/qa-tests
chmod 400 jstests/libs/key*
python buildscripts/resmoke.py --suite=${resmoke_suite} --continueOnFailure --log=buildlogger --reportFile=../../report.json ${resmoke_args} --excludeWithAnyTags="${excludes}"
"run make target":
command: shell.exec
type: test
params:
working_dir: src/github.com/mongodb/mongo-tools
script: |
${_set_shell_env}
PATH=$PATH:$HOME
go run build.go -v ${target}
"download mongod":
command: shell.exec
params:
working_dir: src/github.com/mongodb/mongo-tools
script: |
set -x
set -v
set -e
mongotarget=$(if [ "${mongo_target}" ]; then echo "${mongo_target}"; else echo "${mongo_os}"; fi)
mongoversion=$(if [ "${mongo_version_always_use_latest}" ]; then echo "latest"; else echo "${mongo_version}"; fi)
PATH=/opt/mongodbtoolchain/v3/bin/:$PATH
python="python3"
if [ "Windows_NT" = "$OS" ]; then
python="py.exe -3"
fi
dlurl=$($python binaryurl.py --edition=${mongo_edition} --target=$mongotarget --version=$mongoversion --arch=${mongo_arch|x86_64})
filename=$(echo $dlurl | sed -e "s_.*/__")
mkdir -p bin
curl -s $dlurl --output $filename
${decompress} $filename
rm $filename
if [ "${only_shell}" ]; then
mv -f ./mongodb-*/bin/mongo${extension} ./bin/
else
mv -f ./mongodb-*/bin/mongo${extension} ./bin/
mv -f ./mongodb-*/bin/mongos${extension} ./bin/
mv -f ./mongodb-*/bin/mongod${extension} ./bin/
fi
chmod +x ./bin/*
rm -rf ./mongodb-*
"get buildnumber":
command: keyval.inc
params:
key: "${build_variant}_tools"
destination: "builder_num"
"setup integration test":
command: shell.exec
params:
working_dir: src/github.com/mongodb/mongo-tools
# Set up Kerberos stuff: run kinit if necessary, and add KDC to registry
# on Windows (see https://wiki.mongodb.com/display/DH/Testing+Kerberos)
script: |
set -e
# export sensitive info before `set -x`
if [ '${run_kinit}' = 'true' ]; then
# BUILD-3830
mkdir -p "$(pwd)/.evergreen"
touch "$(pwd)/.evergreen/krb5.conf.empty"
export KRB5_CONFIG="$(pwd)/.evergreen/krb5.conf.empty"
echo "Writing keytab"
echo ${kerberos_keytab} | base64 -d > "$(pwd)/.evergreen/drivers.keytab"
echo "Running kinit"
kinit -k -t "$(pwd)/.evergreen/drivers.keytab" -p [email protected];
fi;
set -x
set -v
if [ "Windows_NT" = "$OS" ]; then
cmd /c "REG ADD HKLM\SYSTEM\ControlSet001\Control\Lsa\Kerberos\Domains\LDAPTEST.10GEN.CC /v KdcNames /d ldaptest.10gen.cc /t REG_MULTI_SZ /f"
fi;
"setup credentials" :
command: shell.exec
params:
working_dir: src/github.com/mongodb/mongo-tools
silent: true
script: |
set -x
set -v
set -e
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
# Resmoke hardcodes the location of this file so we need to copy it to the working directory
# we run resmoke from.
cp mci.buildlogger test/qa-tests
"start mongod":
command: shell.exec
params:
working_dir: src/github.com/mongodb/mongo-tools
background: true
script: |
set -x
set -v
set -e
rm -rf mongodb/db_files mongodb/${logfile|run.log}
mkdir -p mongodb/db_files
MONGOD_ARGS="${mongod_args}"
if [ "${USE_TLS}" = "true" ]; then
MONGOD_ARGS="${mongod_args_tls}"
elif [ "${AWS_AUTH}" = "true" ]; then
MONGOD_ARGS="--auth --setParameter authenticationMechanisms=MONGODB-AWS,SCRAM-SHA-256"
fi;
echo "Starting mongod..."
storage_args=''
if [ "${STORAGE_ENGINE}" != '' ]; then
storage_args='--storageEngine ${STORAGE_ENGINE}'
fi
PATH=$PWD/bin:$PATH ./bin/mongod${extension} --port ${mongod_port} $MONGOD_ARGS ${additional_args} --dbpath mongodb/db_files --setParameter=enableTestCommands=1 $storage_args
"start mongod cluster":
command: shell.exec
params:
working_dir: src/github.com/mongodb/mongo-tools
background: true
script: |
set -x
set -v
set -e
rm -rf mongodb/db_files mongodb/${logfile|run.log}
mkdir -p mongodb/db_files
MONGOD_ARGS="${mongod_args}"
if [ "${USE_TLS}" = "true" ]; then
MONGOD_ARGS="${mongod_args_tls}"
fi;
echo "Starting mongod cluster..."
PATH=$PWD/bin:$PATH ./bin/mongod${extension} --port ${mongod_port} $MONGOD_ARGS ${additional_args} --dbpath mongodb/db_files --setParameter=enableTestCommands=1 --replSet repltester
"wait for mongod to be ready":
command: shell.exec
params:
working_dir: src/github.com/mongodb/mongo-tools
script: |
set -x
set -v
SECS=0
MONGO_ARGS="${mongo_args}"
if [ "${USE_TLS}" = "true" ]; then
MONGO_ARGS="${mongo_args_tls}"
elif [ "${AWS_AUTH}" = "true" ]; then
MONGO_ARGS="--port 33333"
fi;
while true ; do
set -o verbose
./bin/mongo${extension} $MONGO_ARGS --eval 'true;'
if [ "$?" = "0" ]; then
echo "mongod ready";
exit 0
else
SECS=`expr $SECS + 1`
if [ $SECS -gt 100 ]; then
echo "mongod not ready after 100 seconds"
exit 1
fi
echo "waiting for mongod $MONGO_ARGS to be ready..." ;
sleep 1 ;
fi
done
"create mongod users":
command: shell.exec
params:
working_dir: src/github.com/mongodb/mongo-tools
script: |
${_set_shell_env}
MONGO_ARGS="${mongo_args}"
if [ "${USE_TLS}" = "true" ]; then
MONGO_ARGS="${mongo_args_tls}"
fi
echo "db.createUser({ user: '${auth_username}', pwd: '${auth_password}', roles: [{ role: '__system', db: 'admin' }] });" | ./bin/mongo${extension} $MONGO_ARGS admin
"create release artifacts":
# build release artifacts
- command: shell.exec
params:
working_dir: src/github.com/mongodb/mongo-tools
script: |
${_set_shell_env}
go run release/release.go build-archive
go run release/release.go build-packages
# temporary workaround for TOOLS-2606
- command: shell.exec
params:
working_dir: src/github.com/mongodb/mongo-tools
script: |
rm -rf ./mongorestore/testdata/longcollectionname/
# upload individual release artifacts to task page
- command: s3.put
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
local_files_include_filter:
- src/github.com/mongodb/mongo-tools/release.*
- src/github.com/mongodb/mongo-tools/*.deb
- src/github.com/mongodb/mongo-tools/*.rpm
remote_file: mongo-tools/pkgs/${build_id}/
content_type: application/octet-stream
bucket: mciuploads
permissions: public-read
display_name: "Release Artifact - "
# pack all release artifacts into a tarball and upload them to one
# place so that they can be more easily downloaded by the sign task
- command: archive.targz_pack
params:
target: src/github.com/mongodb/mongo-tools/upload.tgz
source_dir: src/github.com/mongodb/mongo-tools
include:
- "./release.*"
- "*.deb"
- "*.rpm"
- command: s3.put
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
local_file: src/github.com/mongodb/mongo-tools/upload.tgz
remote_file: mongo-tools/task/dist/${build_id}/all-release-artifacts.tgz
content_type: application/x-gzip
bucket: mciuploads
permissions: public-read
display_name: All Release Artifacts (.tgz)
"fetch dist release artifacts":
- command: s3.get
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
remote_file: mongo-tools/task/dist/${build_id}/all-release-artifacts.tgz
extract_to: src/github.com/mongodb/mongo-tools/
bucket: mciuploads
"sign msi installer":
- command: shell.exec
type: system
params:
working_dir: src/github.com/mongodb/mongo-tools/
silent: true
script: |
echo "${signing_auth_token}" > ./signing_auth_token
- command: shell.exec
# If the notary service is failing, it should be a system failure to alert the evg team.
# We overwrite the existing release.msi with a signed version via --package-file-suffix ""
type: system
params:
working_dir: src/github.com/mongodb/mongo-tools/
script: |
if [ "${mongo_os}" = "osx" ]; then
exit 0
fi
/usr/local/bin/notary-client.py \
--key-name "server-Tools" \
--auth-token-file ./signing_auth_token \
--comment "Evergreen Automatic Signing (mongo-tools)" \
--notary-url http://notary-service.build.10gen.cc:5000 \
--skip-missing \
--outputs "sig" \
--package-file-suffix "" \
release.msi
"sign macos zip":
- command: shell.exec
params:
working_dir: src/github.com/mongodb/mongo-tools/
silent: false
script: |
# put apple credentials into env vars
AC_USERNAME="${ac_username}"
AC_PASSWORD="${ac_password}"
# turn on verbose debugging for remainder of script
set -o xtrace
set -o errexit
set -o verbose
# this function should do nothing on non-mac platforms
if [ "${mongo_os}" != "osx" ]; then
exit 0
fi
# download and unzip gon
curl -sL https://github.com/mitchellh/gon/releases/download/v0.2.3/gon_macos.zip > gon.zip
unzip gon.zip
# untar the release package and rename dir to "release"
tar xvzf release.tgz
pkgname=$(ls | grep mongodb-database-tools)
rm release.tgz
# gon signing config
cat <<EOF_GON_SIGN_JSON > gon-sign.json
{
"source" : [
"$pkgname/bin/bsondump",
"$pkgname/bin/mongodump",
"$pkgname/bin/mongoexport",
"$pkgname/bin/mongofiles",
"$pkgname/bin/mongoimport",
"$pkgname/bin/mongorestore",
"$pkgname/bin/mongostat",
"$pkgname/bin/mongotop"
],
"bundle_id" : "com.mongodb.mongotools",
"apple_id": {
"username": "$AC_USERNAME",
"password": "$AC_PASSWORD"
},
"sign" :{
"application_identity" : "Developer ID Application: MongoDB, Inc. (4XWMY46275)"
}
}
EOF_GON_SIGN_JSON
# gon notarization config
cat <<EOF_GON_NOTARIZE_JSON > gon-notarize.json
{
"notarize": [{
"path": "$PWD/release.zip",
"bundle_id" : "com.mongodb.mongotools",
"staple": false
}],
"apple_id": {
"username": "$AC_USERNAME",
"password": "$AC_PASSWORD"
}
}
EOF_GON_NOTARIZE_JSON
# sign binaries, re-package as zip, and notarize zip
ssh -v -p 2222 localhost -t "
cd $PWD \
&& ./gon -log-level=info gon-sign.json \
&& zip -r release.zip $pkgname \
&& ./gon -log-level=info gon-notarize.json
"
"sign linux packages":
- command: shell.exec
type: system
params:
working_dir: src/github.com/mongodb/mongo-tools/
silent: true
script: |
if [ "${mongo_os}" = "osx" ]; then
exit 0
fi
echo "${signing_auth_token_server_4_4}" > ./signing_auth_token
- command: shell.exec
type: system
params:
working_dir: src/github.com/mongodb/mongo-tools/
silent: false
script: |
if [ "${mongo_os}" = "osx" ]; then
exit 0
fi
set -o errexit
if [ -e *.rpm ]; then
/usr/local/bin/notary-client.py \
--key-name "server-4.4" \
--auth-token-file ./signing_auth_token \
--comment "Evergreen Automatic Signing (mongo-tools)" \
--notary-url http://notary-service.build.10gen.cc:5000 \
--skip-missing \
--package-file-suffix "" \
--outputs "sig" \
*.rpm
fi
"sign archives":
- command: shell.exec
type: system
params:
working_dir: src/github.com/mongodb/mongo-tools/
silent: true
script: |
echo "${signing_auth_token}" > ./signing_auth_token
- command: shell.exec
type: system
params:
working_dir: src/github.com/mongodb/mongo-tools/
script: |
if [ "${mongo_os}" = "osx" ]; then
exit 0
fi
/usr/local/bin/notary-client.py \
--key-name "server-Tools" \
--auth-token-file ./signing_auth_token \
--comment "Evergreen Automatic Signing (mongo-tools)" \
--notary-url http://notary-service.build.10gen.cc:5000 \
--skip-missing \
--outputs "sig" \
*.zip *.tgz
"upload signed release artifacts":
# temporary workaround for TOOLS-2606
- command: shell.exec
params:
working_dir: src/github.com/mongodb/mongo-tools
script: |
rm -rf ./mongorestore/testdata/longcollectionname/
- command: s3.put
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
local_files_include_filter:
- src/github.com/mongodb/mongo-tools/release.*
- src/github.com/mongodb/mongo-tools/*.deb
- src/github.com/mongodb/mongo-tools/*.rpm
remote_file: mongo-tools/task/sign/${build_id}/
bucket: mciuploads
permissions: public-read
content_type: application/octet-stream
"upload release packages to s3":
- command: shell.exec
params:
working_dir: src/github.com/mongodb/mongo-tools
script: |
${_set_shell_env}
go run release/release.go upload-release
"upload release json feed to s3":
- command: shell.exec
params:
working_dir: src/github.com/mongodb/mongo-tools
script: |
${_set_shell_env}
go run release/release.go upload-json
- command: s3.put
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
local_file: src/github.com/mongodb/mongo-tools/release.json
remote_file: mongo-tools/release/${build_id}/
optional: true
content_type: application/json
bucket: mciuploads
permissions: public-read
"generate full JSON feed":
- command: shell.exec
params:
working_dir: src/github.com/mongodb/mongo-tools
script: |
${_set_shell_env}
go run release/release.go generate-full-json
"upload release packages to linux repos":
- command: shell.exec
params:
working_dir: src/github.com/mongodb/mongo-tools
script: |
curl -L -O http://boxes.10gen.com/build/curator/curator-dist-rhel70-latest.tar.gz
tar -zxvf curator-dist-rhel70-latest.tar.gz
- command: shell.exec
params:
working_dir: src/github.com/mongodb/mongo-tools
script: |
${_set_shell_env}
go run release/release.go linux-release
"fetch source" :
- command: shell.exec
params:
script: |
set -x
set -v
set -e
mkdir -p src/github.com/mongodb
- command: git.get_project
params:
directory: src/github.com/mongodb/mongo-tools
- command: git.apply_patch
params:
directory: src/github.com/mongodb/mongo-tools
- command: shell.exec
params:
working_dir: src/github.com/mongodb/mongo-tools
script: |
set -x
set -v
set -e
mkdir -p bin
"fetch ftdc" :
- command: shell.exec
type: test
params:
working_dir: src/github.com/mongodb/mongo-tools
script: |
set -x
set -v
set -e
GOPATH=$PWD go get github.com/10gen/ftdc-utils/cmd/ftdc
"fetch golangci-lint" :
- command: shell.exec
type: test
params:
working_dir: src/github.com/mongodb/mongo-tools
script: |
set -x
set -v
set -e
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s latest
"create auth_user" :
- command: shell.exec
params:
working_dir: src/github.com/mongodb/mongo-tools
script: |
set -x
set -v
set -e
./bin/mongo --port ${mongod_port} admin --eval "db.createUser({user:\"authorizedUser\", pwd: \"authorizedPwd\", roles:[\"readWriteAnyDatabase\", \"clusterManager\"]});"
"create sharded_cluster" :
- command: shell.exec
params:
working_dir: src/github.com/mongodb/mongo-tools
background: true
script: |
set -x
set -v
set -e
echo "starting sharded cluster"
mkdir -p /data/db/
PATH=./bin:$PATH ./bin/mongo --nodb --eval 'var d = new ShardingTest({shards:3, mongos:[{port:${mongod_port}}]}); while(true){sleep(1000)}'
- command: shell.exec
params:
working_dir: src/github.com/mongodb/mongo-tools
script: |
set -x
set -v
set -e
./bin/mongo --nodb --eval 'var d; assert.soon(function(x){try{d = new Mongo("localhost:${mongod_port}"); return true} catch(e){return false}}, "timed out connection");d.setLogLevel(5, "write");'
"create repl_set" :
- command: shell.exec
params:
working_dir: src/github.com/mongodb/mongo-tools
background: true
script: |
set -x
set -v
set -e
echo "starting repl set"
MONGO_ARGS="${mongo_args}"
NODE_OPTIONS=""
mkdir -p /data/db/
if [ "${USE_TLS}" = "true" ]; then
NODE_OPTIONS="${replsettest_tls_config}"
MONGO_ARGS="${mongo_args_tls}"
elif [ "${USE_SSL}" = "true" ]; then
NODE_OPTIONS="${replsettest_ssl_config}"
fi
PATH=./bin:$PATH ./bin/mongo $MONGO_ARGS --nodb --eval 'TestData = new Object(); TestData.minPort="${mongod_port}"; var repl = new ReplSetTest({nodes:1, name:"repltester", nodeOptions: {'"$NODE_OPTIONS"'}});repl.startSet();repl.initiate();repl.awaitSecondaryNodes();while(true){sleep(1000);}'
- command: shell.exec
params:
working_dir: src/github.com/mongodb/mongo-tools
script: |
set -x
set -v
set -e
MONGO_ARGS="${mongo_args}"
if [ "${USE_TLS}" = "true" ]; then
MONGO_ARGS="${mongo_args_tls}"
fi;
./bin/mongo $MONGO_ARGS --nodb --eval 'assert.soon(function(x){try{var d = new Mongo("localhost:${mongod_port}"); return true} catch(e){return false}}, "timed out connection")'
"add-aws-auth-variables-to-file":
- command: shell.exec
type: test
params:
silent: true
working_dir: src/github.com/mongodb/mongo-tools/common/testdata/lib
script: |
set -x
set -v
set -e
cat <<EOF > $(pwd)/aws_e2e_setup.json
{
"iam_auth_assume_aws_account": "${iam_auth_assume_aws_account}",
"iam_auth_assume_aws_secret_access_key": "${iam_auth_assume_aws_secret_access_key}",
"iam_auth_assume_role_name": "${iam_auth_assume_role_name}"
}
EOF
"setup-aws-auth-test-with-assume-role-credentials":
- command: shell.exec
type: test
params:
silent: true
working_dir: src/github.com/mongodb/mongo-tools/common/testdata/lib
script: |
set -x
set -v
set -e
# The aws_e2e_assume_role script requires python3 with boto3.
# Set up or use an existing python virtualenv for boto3.
venv='venv'
venvNonWindows () { . "$venv"/bin/activate; python3 -m pip install boto3; }
venvWindows () { . "$venv"/Scripts/activate; pip install boto3; }
# default to python3 inside mongodbtoolchain
PATH=/opt/mongodbtoolchain/v3/bin/:$PATH
if [ -f "$venv"/bin/activate ]; then
echo 'activating existing virtualenv'
venvNonWindows
elif [ -f "$venv"/Scripts/activate ]; then
echo 'activating existing virtualenv'
venvWindows
elif virtualenv "$venv" || python -m virtualenv "$venv"; then
echo 'creating new virtualenv'
if [ -f "$venv"/bin/activate ]; then
echo 'activating new virtualenv'
venvNonWindows
elif [ -f "$venv"/Scripts/activate ]; then
echo 'activating new virtualenv'
venvWindows
fi
fi
pip list
../../../bin/mongo --nodb aws_e2e_assume_role.js
- command: shell.exec
type: test
params:
silent: true
working_dir: src/github.com/mongodb/mongo-tools/common/testdata/lib
script: |
set -x
set -v
set -e
jsonkey () { python -c "import sys, json; sys.stdout.write(json.load(sys.stdin)['$1'])" < creds.json; }
urlencode () { python -c "import sys, urllib as ul; sys.stdout.write(ul.quote_plus('$1'))"; }
USER=$(jsonkey AccessKeyId)
USER=$(urlencode $USER)
PASS=$(jsonkey SecretAccessKey)
PASS=$(urlencode $PASS)
MONGOD_URI="mongodb://$USER:$PASS@localhost:33333/?authMechanism=MONGODB-AWS"
SESSION_TOKEN=$(jsonkey SessionToken)
SESSION_TOKEN=$(urlencode $SESSION_TOKEN)
if [ -n $SESSION_TOKEN ]; then
MONGOD_URI="$MONGOD_URI&authMechanismProperties=AWS_SESSION_TOKEN:$SESSION_TOKEN"
fi
echo -n "$MONGOD_URI" > MONGOD_URI
pre:
- command: shell.exec
params:
silent: true
script: |
set -x
set -v
${killall_mci|pkill -9 mongo; pkill -9 mongodump; pkill -9 mongoexport; pkill -9 mongoimport; pkill -9 mongofiles; pkill -9 mongorestore; pkill -9 mongostat; pkill -9 mongotop; pkill -9 mongod; pkill -9 mongos; pkill -f buildlogger.py; pkill -f smoke.py} >/dev/null 2>&1
rm -rf src /data/db/*
exit 0
- command: shell.exec
params:
script: |
cat <<EOT > expansions.yml
_set_shell_env: |
. ./set_goenv.sh
GOROOT=""; set_goenv || exit
export EVG_IS_PATCH='${is_patch}'
export EVG_TRIGGERED_BY_TAG='${triggered_by_git_tag}'
export EVG_BUILD_ID='${build_id}'
export EVG_VERSION='${version_id}'
export EVG_VARIANT='${build_variant}'
if [ '${_platform}' != '' ]; then
export EVG_VARIANT='${_platform}'
fi
export EVG_USER='${evg_user}'
export EVG_KEY='${evg_key}'
export AWS_ACCESS_KEY_ID='${release_aws_access_key_id}'
export AWS_SECRET_ACCESS_KEY='${release_aws_secret}'
export NOTARY_TOKEN_4_4='${signing_auth_token_server_4_4}'
export NOTARY_TOKEN_5_0='${signing_auth_token_server_5_0}'
export BARQUE_USERNAME='${evg_user}'
export BARQUE_API_KEY='${barque_api_key}'
export TOOLS_TESTING_AUTH_USERNAME='${auth_username}'
export TOOLS_TESTING_AUTH_PASSWORD='${auth_password}'
export MONGODB_KERBEROS_PASSWORD='${kerberos_password}'
export ATLAS_URI=${atlas_srv_uri}
export TOOLS_TESTING_PKCS8_PASSWORD=${pkcs8_password}
set -o xtrace
set -o verbose
set -o errexit
EOT
- command: expansions.update
params:
file: expansions.yml
post:
# attach.results works for jstests, gotest.parse_files for golang tests
- command: attach.results
params:
file_location: src/github.com/mongodb/mongo-tools/report.json
- command: gotest.parse_files
params:
files: ["src/github.com/mongodb/mongo-tools/testing_output/*.suite"]
- command: shell.exec
params:
silent: true
script: |
set -x
set -v
${killall_mci|pkill -9 mongo; pkill -9 mongodump; pkill -9 mongoexport; pkill -9 mongoimport; pkill -9 mongofiles; pkill -9 mongorestore; pkill -9 mongostat; pkill -9 mongotop; pkill -9 mongod; pkill -9 mongos; pkill -f buildlogger.py; pkill -f smoke.py} >/dev/null 2>&1
exit 0
- command: shell.exec
params:
script: |
set -x
set -v
rm -rf /data/db/*
exit 0
timeout:
- command: shell.exec
params:
silent: true
script: |
set -x
set -v
# don't attempt to abort on any distro which has a special way of
# killing everything (i.e. using taskkill on Windows)
if [ "${killall_mci}" = "" ]; then
all_tools="bsondump mongodump mongoexport mongofiles mongoimport mongorestore mongostat mongotop"
# send SIGABRT to print a stacktrace for any hung tool
pkill -ABRT "^($(echo -n $all_tools | tr ' ' '|'))\$"
# git the processes a second or two to dump their stacks
sleep 10
fi
tasks:
- name: dist
tags: ["git_tag"]
depends_on:
commands:
- func: "fetch source"
# bsondump
- func: "run make target"
vars:
target: build
- func: "create release artifacts"
# Regardless of the buildvariant, the sign task must be run on a
# distro that has the notary client available. We will use
# amazon1-2018-test for this purpose. The notary client is not
# available on all distros, which is why sign must be a separate task.
- name: sign
tags: ["git_tag"]
depends_on:
- name: dist
commands:
- func: "fetch dist release artifacts"
- func: "sign msi installer"
- func: "sign macos zip"
- func: "sign linux packages"
- func: "sign archives"
- func: "upload signed release artifacts"
- name: push
tags: ["git_tag"]
depends_on:
- name: sign
commands:
- func: "fetch source"
- command: expansions.update
- func: "upload release packages to s3"
- func: "upload release packages to linux repos"
- name: release-json
tags: ["git_tag"]
depends_on:
- name: push
variant: '*'
commands:
- func: "fetch source"
- command: expansions.update
- func: "upload release json feed to s3"
- name: generate-full-json
commands:
- func: "fetch source"
- command: expansions.update
- func: "generate full JSON feed"
- name: integration-3.4
tags: ["3.4"]
commands:
- func: "fetch source"
- command: expansions.update
- func: "download mongod"
vars:
mongo_version: "3.4"
- func: "start mongod"
- func: "wait for mongod to be ready"
- func: "run make target"
vars:
target: build
- func: "run make target"
vars:
target: test:integration test:srv -ssl=true
- name: integration-3.4-mmapv1
tags: ["3.4", "mmap"]
commands:
- func: "fetch source"
- command: expansions.update
- func: "download mongod"
vars:
mongo_version: "3.4"
- func: "start mongod"
vars:
STORAGE_ENGINE: "mmapv1"
- func: "wait for mongod to be ready"
- func: "run make target"
vars:
target: build
- func: "run make target"
vars:
target: test:integration test:srv -ssl=true
- name: integration-3.6
tags: ["3.6"]
commands:
- func: "fetch source"
- command: expansions.update
- func: "download mongod"
vars:
mongo_version: "3.6"
- func: "start mongod"
- func: "wait for mongod to be ready"
- func: "run make target"
vars:
target: build
- func: "run make target"
vars:
target: test:integration test:srv -ssl=true
- name: integration-3.6-mmapv1
tags: ["3.6", "mmap"]
commands:
- func: "fetch source"
- command: expansions.update
- func: "download mongod"
vars:
mongo_version: "3.6"
- func: "start mongod"
vars:
STORAGE_ENGINE: "mmapv1"
- func: "wait for mongod to be ready"
- func: "run make target"
vars:
target: build
- func: "run make target"
vars:
target: test:integration test:srv -ssl=true
- name: integration-4.0
tags: ["4.0"]
commands:
- func: "fetch source"
- command: expansions.update
- func: "download mongod"
vars:
mongo_version: "4.0"
- func: "start mongod"
- func: "wait for mongod to be ready"
- func: "run make target"
vars:
target: build
- func: "run make target"
vars:
target: test:integration test:srv -ssl=true
- name: integration-4.0-auth
tags: ["4.0", "auth"]
commands:
- func: "fetch source"
# Concat auth args
- command: expansions.update
params:
updates:
- key: "mongod_args"
concat: " --auth"
- func: "download mongod"
vars:
mongo_version: "4.0"
- func: "start mongod"
- func: "wait for mongod to be ready"
- func: "create mongod users"
- func: "run make target"
vars:
target: build
- func: "run make target"
vars:
target: test:integration test:srv -ssl=true -auth=true
- name: integration-4.0-cluster
tags: ["4.0", "cluster"]
commands:
- func: "fetch source"
- command: expansions.update
- func: "download mongod"
vars:
mongo_version: "4.0"