forked from mongodb/mongo-odbc-driver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathevergreen.yml
2259 lines (2063 loc) · 82.8 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
# Evergreen Project Config
# When a task that used to pass starts to fail
# Go through all versions that may have been skipped to detect
# when the task started failing
stepback: true
# Mark a failure as a system/bootstrap failure (purple box) rather then a task
# failure by default.
# Actual testing tasks are marked with `type: test`
command_type: system
# Protect ourself against rogue test case, or curl gone wild, that runs forever
# 12 minutes is the longest we'll ever run
exec_timeout_secs: 3600 # 12 minutes is the longest we'll ever run
ignore:
- "*.md"
# What to do when evergreen hits the timeout (`post:` tasks are run automatically)
timeout:
- command: shell.exec
params:
script: |
ls -la
functions:
"fetch for windows sign":
- command: s3.get
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
remote_file: mongosql-odbc-driver/artifacts/${version_id}/${build_variant}/release/mongoodbc.msi
local_file: mongosql-odbc-driver/installer/msi/mongoodbc.msi
bucket: mciuploads
"fetch for ubuntu sign":
- command: s3.get
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
remote_file: mongosql-odbc-driver/artifacts/${version_id}/${build_variant}/release/mongoodbc.tar.gz
local_file: mongosql-odbc-driver/installer/tgz/mongoodbc.tar.gz
bucket: mciuploads
"fetch source":
- command: git.get_project
params:
directory: mongosql-odbc-driver
"generate expansions":
- command: shell.exec
params:
shell: bash
working_dir: mongosql-odbc-driver
script: |
export CARGO_NET_GIT_FETCH_WITH_CLI=true
export INSTALLED_ODBC_PATH="$PWD/installed_odbc/install"
export LD_LIBRARY_PATH="$INSTALLED_ODBC_PATH/lib"
export PATH="$LD_LIBRARY_PATH:$PATH:$HOME/.cargo/bin"
export DUMP_FOLDER=dumps
export LOCAL_DUMP_ORIGINAL_REG_VAL=local_dump_original_value.reg
export MONGOODBC_DEBUGGING_INFO_ARCHIVE=crashDebuggingInfo
export SCRIPT_FOLDER=resources
export COMPLIANCE_REPORT_NAME="mongo-odbc-driver_compliance_report.md"
export STATIC_CODE_ANALYSIS_NAME="mongo-odbc-driver.sast.sarif"
if [[ "${triggered_by_git_tag}" != "" ]]; then
export RELEASE_VERSION=$(echo ${triggered_by_git_tag} | sed s/v//)
else
export RELEASE_VERSION=snapshot
fi
export MSI_FILENAME="mongoodbc.msi"
cat <<EOT > expansions.yml
RELEASE_VERSION: "$RELEASE_VERSION"
MSI_FILENAME: "$MSI_FILENAME"
WINDOWS_INSTALLER_PATH: "mongosql-odbc-driver/windows/$RELEASE_VERSION/release/$MSI_FILENAME"
UBUNTU2204_INSTALLER_PATH: "mongosql-odbc-driver/ubuntu2204/$RELEASE_VERSION/release/mongoodbc.tar.gz"
COMPLIANCE_REPORT_NAME: "$COMPLIANCE_REPORT_NAME"
STATIC_CODE_ANALYSIS_NAME: "$STATIC_CODE_ANALYSIS_NAME"
prepare_shell: |
set -o errexit
export RELEASE_VERSION="$RELEASE_VERSION"
export MSI_FILENAME="$MSI_FILENAME"
export WINDOWS_INSTALLER_PATH="$WINDOWS_INSTALLER_PATH"
export UBUNTU2204_INSTALLER_PATH="$UBUNTU2204_INSTALLER_PATH"
export PATH="$PATH"
export CARGO_NET_GIT_FETCH_WITH_CLI="$CARGO_NET_GIT_FETCH_WITH_CLI"
git config --global url."ssh://[email protected]/".insteadOf "https://github.com/"
export LOCAL_MDB_PORT_COM=${local_mdb_port_com}
export LOCAL_MDB_PORT_ENT=${local_mdb_port_ent}
export LOCAL_MDB_USER=${local_mdb_user}
export LOCAL_MDB_PWD=${local_mdb_pwd}
export ADF_TEST_LOCAL_USER="${adf_test_local_user}"
export ADF_TEST_LOCAL_PWD="${adf_test_local_pwd}"
export ADF_TEST_LOCAL_AUTH_DB="${adf_test_local_auth_db}"
export ADF_TEST_LOCAL_HOST="${adf_test_local_host}"
export MDB_TEST_LOCAL_PORT="${mdb_test_local_port}"
export ADF_TEST_LOCAL_DB="${adf_test_local_db}"
export ADF_TEST_URI="${adf_test_uri}"
export SRV_TEST_DB="${srv_test_db}"
export SRV_TEST_AUTH_DB="${srv_test_auth_db}"
export SRV_TEST_HOST="${srv_test_host}"
export SRV_TEST_USER="${srv_test_user}"
export SRV_TEST_PWD="${srv_test_pwd}"
export SCRIPT_FOLDER="$SCRIPT_FOLDER"
export SCRIPT_DIR="$(pwd)/$SCRIPT_FOLDER"
export SBOM_DIR="sbom_tools"
export SBOM_LICENSES="mongo-odbc-driver.licenses.cdx.json"
export SBOM_VULN="mongo-odbc-driver.merge.grype.cdx.json"
export SBOM_FINAL="mongo-odbc-driver.full.cdx.json"
export COMPLIANCE_REPORT_NAME="$COMPLIANCE_REPORT_NAME"
export STATIC_CODE_ANALYSIS_NAME="$STATIC_CODE_ANALYSIS_NAME"
export ALLOW_VULNS="${AllowVulns}"
# Windows variables
export LOCAL_DUMP_ORIGINAL_REG_VAL="$LOCAL_DUMP_ORIGINAL_REG_VAL"
export DUMP_FOLDER="$DUMP_FOLDER"
export DUMP_PATH="$(pwd)/$DUMP_FOLDER"
export MONGOODBC_DEBUGGING_INFO_ARCHIVE=$MONGOODBC_DEBUGGING_INFO_ARCHIVE
# Non-Windows variables
export INSTALLED_ODBC_PATH="$INSTALLED_ODBC_PATH"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH"
export LIBRARY_PATH="$LD_LIBRARY_PATH"
export ODBCSYSINI="$(pwd)"/setup
EOT
- command: expansions.update
params:
file: mongosql-odbc-driver/expansions.yml
"generate github token":
command: github.generate_token
params:
owner: 10gen
repo: mongohouse
expansion_name: github_token
"install rust toolchain":
- command: shell.exec
params:
shell: bash
script: |
${prepare_shell}
# make sure to use msvc toolchain rather than gnu, which is
# the default for cygwin
if [ "Windows_NT" == "$OS" ]; then
if [ 'windows-64' == '${build_variant}' ]; then
export HOST="x86_64-pc-windows-msvc"
else
echo 'unknown windows build variant ${build_variant}'
exit 1;
fi
export DEFAULT_HOST_OPTIONS="--default-host $HOST"
export DEFAULT_TOOLCHAIN="stable-$HOST"
fi
# install rustup from scratch
rm -rf ~/.rustup
curl https://sh.rustup.rs -sSf | sh -s -- -y --no-modify-path $DEFAULT_HOST_OPTIONS
# rustup installs into C:\Users\$USER instead of
# C:\home\$USER, so we symlink both .rustup and .cargo
if [ "Windows_NT" == "$OS" ]; then
ln -sf /cygdrive/c/Users/$USER/.rustup/ ~/.rustup
ln -sf /cygdrive/c/Users/$USER/.cargo/ ~/.cargo
rustup toolchain install $DEFAULT_TOOLCHAIN
rustup default $DEFAULT_TOOLCHAIN
fi
echo --------- rustup show -----------
rustup show
echo ----- Rustup toolchain list -----
rustup toolchain list
echo ---------------------------------
"check clippy":
- command: shell.exec
type: test
params:
shell: bash
working_dir: mongosql-odbc-driver
script: |
${prepare_shell}
cargo clippy --all-targets -- -D warnings
"check rustfmt":
- command: shell.exec
type: test
params:
shell: bash
working_dir: mongosql-odbc-driver
script: |
${prepare_shell}
cargo fmt --all -- --check
"check unused dependencies":
- command: shell.exec
type: test
params:
shell: bash
working_dir: mongosql-odbc-driver
script: |
${prepare_shell}
cargo install cargo-machete
set +e
cargo machete
RETURN=$?
set -e
if [ $RETURN -ne 0 ]; then
>&2 echo "Unused dependencies found"
>&2 cargo machete
fi
"generate SBOM":
- command: shell.exec
type: test
params:
shell: bash
working_dir: mongosql-odbc-driver
script: |
${prepare_shell}
echo ">>>> Install SBOM tool..."
OS=$(uname)
echo "OS=$OS"
ARCH="$(uname -m)"
echo "Arch=$ARCH"
mkdir $SBOM_DIR
echo "SBOM with vulnerabilities: $SBOM_LICENSES";
echo "SBOM with license: $SBOM_VULN";
echo "Final SBOM with all information: $SBOM_FINAL"
# Install cargo-cyclonedx
echo "-- Installing cargo-cyclonedx --"
cargo install cargo-cyclonedx
echo "------------------------------------"
# Install Grype
echo "-- Downloading Grype --"
curl -sSfL https://raw.githubusercontent.com/anchore/grype/main/install.sh | sh -s -- -b $SBOM_DIR
echo "------------------------------------"
# Install CycloneDX CLI and JQ
CYCLONE_URL="https://github.com/CycloneDX/cyclonedx-cli/releases/download/v0.25.0"
JQ_URL="https://github.com/jqlang/jq/releases/download/jq-1.7.1"
if [[ "$OS" = "Linux" ]]; then
if [[ "$ARCH" = "x86_64" ]]; then
CYCLONE_URL="$CYCLONE_URL/cyclonedx-linux-x64"
JQ_URL="$JQ_URL/jq-linux-amd64"
elif [ "$ARCH" = "arm64" ]; then
CYCLONE_URL="$CYCLONE_URL/cyclonedx-linux-arm64"
JQ_URL="$JQ_URL/jq-linux-arm64"
fi
elif [[ "$OS" = "Darwin" ]]; then
if [[ "$ARCH" = "arm64" ]]; then
CYCLONE_URL="$CYCLONE_URL/cyclonedx-osx-arm64"
JQ_URL="$JQ_URL/jq-macos-arm64"
else
CYCLONE_URL="$CYCLONE_URL/cyclonedx-osx-x64"
JQ_URL="$JQ_URL/jq-macos-amd64"
fi
else
# Windows
CYCLONE_URL="$CYCLONE_URL/cyclonedx-win-x64.exe"
JQ_URL="$JQ_URL/jq-windows-amd64.exe"
fi
echo "-- Downloading CycloneDX CLI for $OS-$ARCH $CYCLONE_URL --"
curl -L -o $SBOM_DIR/cyclonedx-cli "$CYCLONE_URL" \
--silent \
--fail \
--max-time 60 \
--retry 5 \
--retry-delay 0
chmod +x ./$SBOM_DIR/cyclonedx-cli
echo "------------------------------------"
echo "-- Downloading JQ $JQ_URL --"
curl -L -o $SBOM_DIR/jq "$JQ_URL" \
--silent \
--fail \
--max-time 60 \
--retry 5 \
--retry-delay 0
chmod +x ./$SBOM_DIR/jq
echo "------------------------------------"
echo "<<<< Done installing SBOM tools"
echo ">>>> Generate SBOM..."
echo "-- Generating SBOMs with the licenses information --"
cargo cyclonedx --target all -v -f json
echo "------------------------------------"
echo "-- Merging info from both mongo-odbc-driver and win_setupgui because both are packaged libraries --"
echo "./$SBOM_DIR/cyclonedx-cli merge --input-files ./odbc/mongo-odbc-driver.cdx.json ./win_setupgui/win_setupgui.cdx.json --output-format json --input-format json --group mongo-odbc-driver --name mongo-odbc-driver> $SBOM_LICENSES"
./$SBOM_DIR/cyclonedx-cli merge --input-files ./odbc/mongo-odbc-driver.cdx.json ./win_setupgui/win_setupgui.cdx.json --output-format json --input-format json --group mongo-odbc-driver --name mongo-odbc-driver> $SBOM_LICENSES
echo "------------------------------------"
echo "-- Generating SBOM with vulnerabilities information --"
echo "./$SBOM_DIR/grype sbom:$SBOM_LICENSES -o cyclonedx-json > $SBOM_VULN"
./$SBOM_DIR/grype sbom:$SBOM_LICENSES -o cyclonedx-json > $SBOM_VULN
echo "------------------------------------"
echo "-- Merging the SBOMs with the licenses information and the SBOM with the vulnerabilities information in $SBOM_FINAL --"
temp_output="temp_output.json"
if [[ -f "$temp_output" ]] ; then
rm "$temp_output"
fi
touch $temp_output
while IFS= read -r line
do
if [[ "$line" == *"purl"* ]]; then
bash_purl=$(echo $line | cut -d '"' -f4)
command=$(echo "./$SBOM_DIR/jq '.components[] | select(.purl == \"$bash_purl\").licenses' $SBOM_LICENSES | ./$SBOM_DIR/jq -s 'flatten(1)'")
# Add the license information back in the augmented SBOM.
licenseInfo=$(eval " $command")
if [[ -z "$licenseInfo" ]]; then
echo "\"licenses\" : []," >> $temp_output
else
echo "\"licenses\" : $licenseInfo," >> $temp_output
fi
fi
echo "$line" >> $temp_output
done < $SBOM_VULN
echo "------------------------------------"
echo "-- Adding the name of the team responsible for each dependency as required by Silk and format the json file --"
echo "./$SBOM_DIR/jq '.components[].properties += [{\"name\": \"internal:team_responsible\", \"value\": \"Atlas SQL\"}]' $temp_output > $SBOM_FINAL"
./$SBOM_DIR/jq '.components[].properties += [{"name": "internal:team_responsible", "value": "Atlas SQL"}]' $temp_output > $SBOM_FINAL
echo "------------------------------------"
echo "-- Adding VEX info for vulnerabilities still present in SBOM--"
IFS=','; for vuln_id in $ALLOW_VULNS; do
echo "-- Updating SBOM with VEX info for vulnerability with id $vuln_id--"
export VULN_ID=$vuln_id
echo "jq --argjson vexinfo "$(<resources/ssdlc/$VULN_ID.analysis.json)" '(.vulnerabilities[] | select(.id == $ENV.VULN_ID)).analysis = ($vexinfo) ' $SBOM_FINAL > output.tmp && mv output.tmp $SBOM_FINAL"
jq --argjson vexinfo "$(<resources/ssdlc/$VULN_ID.analysis.json)" '(.vulnerabilities[] | select(.id == $ENV.VULN_ID)).analysis = ($vexinfo) ' $SBOM_FINAL > output.tmp && mv output.tmp $SBOM_FINAL
echo "--------"
done
echo "-----------------------------"
echo "<<<< Done generating SBOM"
- command: s3.put
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
local_files_include_filter:
- mongosql-odbc-driver/*.cdx.json
remote_file: mongosql-odbc-driver/artifacts/${version_id}/ssdlc/
content_type: text/plain
bucket: mciuploads
permissions: public-read
"scan SBOM":
- command: shell.exec
type: test
params:
shell: bash
working_dir: mongosql-odbc-driver
script: |
${prepare_shell}
echo ">>>> Scan SBOM for vulnerabilities..."
if [[ "$ALLOW_VULNS" != "" ]]; then
echo "Vulnerability ids to ignore : $ALLOW_VULNS"
echo "-- Generate .grype.yaml specifying vulnerabilities to ignore --"
GRYPE_CONF_FILE=".grype.yaml"
touch $GRYPE_CONF_FILE
echo "ignore:" > $GRYPE_CONF_FILE
IFS=','; for VULN_ID in $ALLOW_VULNS; do
echo "Ignoring vulnerability with id $VULN_ID"
echo " - vulnerability: $VULN_ID" >> $GRYPE_CONF_FILE
done
echo "------------------------------------"
fi
echo "-- Scanning dependency for vulnerabilities --"
./$SBOM_DIR/grype sbom:$SBOM_LICENSES --fail-on low
echo "---------------------------------------------"
echo "<<<< Done scanning SBOM"
"generate compliance report":
- command: shell.exec
params:
shell: bash
working_dir: mongosql-odbc-driver
env:
IS_TAG_TRIGGERED: "${triggered_by_git_tag}"
AUTHOR: "${author}"
AUTHOR_EMAIL: "${author_email}"
script: |
${prepare_shell}
echo "Author = $AUTHOR"
echo "Author email = $AUTHOR_EMAIL"
echo "Version = $RELEASE_VERSION"
SBOM_URL="https://translators-connectors-releases.s3.amazonaws.com/mongosql-odbc-driver/mongosql-odbc-${RELEASE_VERSION}.sbom.json"
SARIF_URL="https://translators-connectors-releases.s3.amazonaws.com/mongosql-odbc-driver/mongo-odbc-$RELEASE_VERSION.sast.sarif"
echo "Sbom url = $SBOM_URL"
echo "Sarif Url = $SARIF_URL"
# Copy template
cp resources/ssdlc/mongo-odbc-driver_compliance_report_template.md $COMPLIANCE_REPORT_NAME
# Update the version
sed -i.bu "s,%VERSION%,$RELEASE_VERSION,g" $COMPLIANCE_REPORT_NAME
# Update the SBOM link
sed -i.bu "s,%SBOM_URL%,$SBOM_URL,g" $COMPLIANCE_REPORT_NAME
# Update the SARIF link
sed -i.bu "s,%SARIF_URL%,$SARIF_URL,g" $COMPLIANCE_REPORT_NAME
# Update the author information
sed -i.bu "s,%AUTHOR%,$AUTHOR,g" $COMPLIANCE_REPORT_NAME
sed -i.bu "s,%AUTHOR_EMAIL%,$AUTHOR_EMAIL,g" $COMPLIANCE_REPORT_NAME
- command: s3.put
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
local_file: mongosql-odbc-driver/${COMPLIANCE_REPORT_NAME}
remote_file: mongosql-odbc-driver/artifacts/${version_id}/ssdlc/${COMPLIANCE_REPORT_NAME}
content_type: text/markdown
bucket: mciuploads
permissions: public-read
"publish compliance report":
- command: s3.get
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
local_file: mongosql-odbc-driver/${COMPLIANCE_REPORT_NAME}
remote_file: mongosql-odbc-driver/artifacts/${version_id}/ssdlc/${COMPLIANCE_REPORT_NAME}
content_type: text/markdown
bucket: mciuploads
- command: s3.put
params:
aws_key: ${release_aws_key}
aws_secret: ${release_aws_secret}
local_file: mongosql-odbc-driver/${COMPLIANCE_REPORT_NAME}
remote_file: mongosql-odbc-driver/mongosql-odbc-${RELEASE_VERSION}-compliance-report.md
content_type: text/markdown
bucket: translators-connectors-releases
permissions: public-read
display_name: mongosql-odbc-${RELEASE_VERSION}-compliance-report.md
"push SBOM Lite to Silk":
- command: shell.exec
type: test
params:
shell: bash
working_dir: mongosql-odbc-driver
script: |
${prepare_shell}
cat << EOF > silkbomb.env
SILK_CLIENT_ID=${SILK_CLIENT_ID}
SILK_CLIENT_SECRET=${SILK_CLIENT_SECRET}
EOF
echo "SBOM_FINAL = $SBOM_FINAL"
echo "-- Uploading initial SBOM Lite to Silk --"
docker run -i --platform="linux/amd64" --rm -v "$PWD":/pwd \
--env-file silkbomb.env \
artifactory.corp.mongodb.com/release-tools-container-registry-public-local/silkbomb:1.0 \
upload --silk-asset-group ${SILK_ASSET_GROUP} --sbom-in /pwd/$SBOM_FINAL --force
echo "-------------------------------"
"pull augmented SBOM from Silk":
- command: shell.exec
type: test
params:
shell: bash
working_dir: mongosql-odbc-driver
script: |
${prepare_shell}
cat << EOF > silkbomb.env
SILK_CLIENT_ID=${SILK_CLIENT_ID}
SILK_CLIENT_SECRET=${SILK_CLIENT_SECRET}
EOF
echo "-- Downloading augmented SBOM --"
docker run -i --platform="linux/amd64" --rm -v "$PWD":/pwd \
--env-file silkbomb.env \
artifactory.corp.mongodb.com/release-tools-container-registry-public-local/silkbomb:1.0 \
download --silk-asset-group ${SILK_ASSET_GROUP} --sbom-out /pwd/mongo-odbc-driver.augmented.sbom.json
echo "-------------------------------"
- command: s3.put
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
local_file: mongosql-odbc-driver/mongo-odbc-driver.augmented.sbom.json
remote_file: mongosql-odbc-driver/artifacts/${version_id}/ssdlc/mongo-odbc-driver.augmented.sbom.json
content_type: application/json
bucket: mciuploads
permissions: public-read
"publish augmented SBOM":
- command: s3.get
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
local_file: mongosql-odbc-driver/mongo-odbc-driver.augmented.sbom.json
remote_file: mongosql-odbc-driver/artifacts/${version_id}/ssdlc/mongo-odbc-driver.augmented.sbom.json
content_type: application/json
bucket: mciuploads
permissions: public-read
- command: s3.put
params:
aws_key: ${release_aws_key}
aws_secret: ${release_aws_secret}
local_file: mongosql-odbc-driver/mongo-odbc-driver.augmented.sbom.json
remote_file: mongosql-odbc-driver/mongosql-odbc-${RELEASE_VERSION}.sbom.json
bucket: translators-connectors-releases
content_type: application/json
permissions: public-read
display_name: mongosql-odbc-${RELEASE_VERSION}.sbom.json
"set and check packages version":
- command: shell.exec
type: test
params:
shell: bash
working_dir: mongosql-odbc-driver
script: |
${prepare_shell}
#no-op when not triggered by a tag
if [[ "${triggered_by_git_tag}" != "" ]]; then
cargo install cargo-edit
cargo set-version $RELEASE_VERSION
fi
cargo install cargo-get
CARGO_PKGS_VERSION=$(cargo get --entry="odbc/Cargo.toml" package.version)
if [[ "${triggered_by_git_tag}" == "" ]]; then
EXPECTED_RELEASE_VERSION="0.0.0"
else
EXPECTED_RELEASE_VERSION="$RELEASE_VERSION"
fi
if [[ "$CARGO_PKGS_VERSION" != "$EXPECTED_RELEASE_VERSION" ]]; then
echo "Expected version $EXPECTED_RELEASE_VERSION got $CARGO_PKGS_VERSION"
exit 1
fi
"sign windows":
- command: shell.exec
type: system
params:
silent: true
script: |
docker login --username ${sql_engines_artifactory_username} --password ${sql_engines_artifactory_auth_token} ${release_tools_container_registry}
- command: shell.exec
type: system
params:
silent: true
env:
GRS_CONFIG_USER1_USERNAME: "${odbc_garasign_username}"
GRS_CONFIG_USER1_PASSWORD: "${odbc_garasign_password}"
working_dir: mongosql-odbc-driver/installer/msi
script: |
docker run \
-e GRS_CONFIG_USER1_USERNAME \
-e GRS_CONFIG_USER1_PASSWORD \
--rm \
-v $(pwd):$(pwd) -w $(pwd) \
${garasign_jsign_image} \
/bin/bash -c "jsign -a ${authenticode_key_name} --replace --tsaurl http://timestamp.digicert.com -d SHA-256 ${MSI_FILENAME}"
# Generating checksums
if [ -e $msi_filename ]; then
shasum -a 1 ${MSI_FILENAME} | tee ${MSI_FILENAME}.sha1
shasum -a 256 ${MSI_FILENAME} | tee ${MSI_FILENAME}.sha256
md5sum ${MSI_FILENAME} | tee ${MSI_FILENAME}.md5
else
echo "${MSI_FILENAME} does not exist. Skipping checksum generation"
fi
"sign ubuntu and verify signature":
- command: shell.exec
type: system
params:
silent: true
script: |
docker login --username ${sql_engines_artifactory_username} --password ${sql_engines_artifactory_auth_token} ${release_tools_container_registry}
- command: shell.exec
type: system
params:
silent: true
env:
GRS_CONFIG_USER1_USERNAME: "${odbc_garasign_username}"
GRS_CONFIG_USER1_PASSWORD: "${odbc_garasign_password}"
working_dir: mongosql-odbc-driver/installer/tgz
script: |
docker run \
-e GRS_CONFIG_USER1_USERNAME \
-e GRS_CONFIG_USER1_PASSWORD \
--rm \
-v $(pwd):$(pwd) -w $(pwd) \
${garasign_gpg_image} \
/bin/bash -c "gpgloader && gpg --yes -v --armor -o mongoodbc.tar.gz.sig --detach-sign mongoodbc.tar.gz"
- command: shell.exec
type: system
params:
working_dir: mongosql-odbc-driver/installer/tgz
silent: true
env:
GRS_CONFIG_USER1_USERNAME: "${odbc_garasign_username}"
GRS_CONFIG_USER1_PASSWORD: "${odbc_garasign_password}"
script: |
docker run \
-e GRS_CONFIG_USER1_USERNAME \
-e GRS_CONFIG_USER1_PASSWORD \
--rm \
-v $(pwd):$(pwd) -w $(pwd) \
${garasign_gpg_image} \
/bin/bash -c "gpgloader && gpg --verify mongoodbc.tar.gz.sig mongoodbc.tar.gz"
"compile ubuntu and win release":
- command: shell.exec
type: test
params:
shell: bash
working_dir: mongosql-odbc-driver
script: |
${prepare_shell}
# Compile release build
cargo build --release
# Verify the version is the expected one from the driver perspective too
cargo test api::get_info_tests::unit::driver_ver -- --nocapture
"compile ubuntu and win debug":
- command: shell.exec
type: test
params:
shell: bash
working_dir: mongosql-odbc-driver
script: |
${prepare_shell}
# Compile debug build
cargo build
"compile ubuntu with asan":
- command: shell.exec
type: test
params:
shell: bash
working_dir: mongosql-odbc-driver
script: |
${prepare_shell}
~/.cargo/bin/rustup default nightly
~/.cargo/bin/rustup target add x86_64-unknown-linux-gnu
export RUSTFLAGS="-Z sanitizer=address"
cargo build --target x86_64-unknown-linux-gnu
"compile release with debug info":
- command: shell.exec
params:
shell: bash
working_dir: mongosql-odbc-driver
script: |
${prepare_shell}
echo "env $(env)"
# Build a release driver with debug information
cargo build --release
export DRIVER_LIB_PATH=$PWD/target/release
cat <<EOT >> expansions.yml
export DRIVER_LIB_PATH="$DRIVER_LIB_PATH"
EOT
- command: expansions.update
params:
file: mongosql-odbc-driver/expansions.yml
"compile macos release":
- command: shell.exec
type: test
params:
shell: bash
working_dir: mongosql-odbc-driver
script: |
${prepare_shell}
# Compile release build
cargo build --release --features definitions/iodbc,cstr/utf32
# Verify the version is the expected one from the driver perspective too
cargo test api::get_info_tests::unit::driver_ver -- --nocapture
"compile macos debug":
- command: shell.exec
type: test
params:
shell: bash
working_dir: mongosql-odbc-driver
script: |
${prepare_shell}
# Compile debug build
cargo build --features definitions/iodbc,cstr/utf32
"compile macos release with debug info":
- command: shell.exec
params:
shell: bash
working_dir: mongosql-odbc-driver
script: |
${prepare_shell}
echo "env $(env)"
# Build a release driver with debug information
cargo build --features definitions/iodbc,cstr/utf32 --release
export DRIVER_LIB_PATH=$PWD/target/release
cat <<EOT >> expansions.yml
export DRIVER_LIB_PATH="$DRIVER_LIB_PATH"
EOT
- command: expansions.update
params:
file: mongosql-odbc-driver/expansions.yml
"build msi":
- command: s3.get
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
local_file: mongosql-odbc-driver/mongo-odbc-driver.augmented.sbom.json
remote_file: mongosql-odbc-driver/artifacts/${version_id}/ssdlc/mongo-odbc-driver.augmented.sbom.json
content_type: application/json
bucket: mciuploads
permissions: public-read
- command: shell.exec
params:
shell: bash
working_dir: mongosql-odbc-driver
script: |
${prepare_shell}
cp target/release/*.dll installer/msi
cp ./README.md ./mongo-odbc-driver.augmented.sbom.json installer/msi
cd installer/msi
if [ "$RELEASE_VERSION" == "snapshot" ]; then
MINOR_VERSION="0.1"
VERSION_LABEL="0.1.0"
else
MINOR_VERSION=$(echo "$RELEASE_VERSION" | cut -d '.' -f 1-2)
VERSION_LABEL="$RELEASE_VERSION"
fi
# unfortunately, using a variable to hold the path to powershell
# seems to not work properly with evergreen's bash
/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe\
-NoProfile\
-NoLogo\
-NonInteractive\
-ExecutionPolicy ByPass\
-File ./build-msi.ps1\
-Arch x64\
-Version "$MINOR_VERSION"\
-VersionLabel "$VERSION_LABEL"\
"build dmg":
- command: s3.get
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
local_file: mongosql-odbc-driver/mongo-odbc-driver.augmented.sbom.json
remote_file: mongosql-odbc-driver/artifacts/${version_id}/ssdlc/mongo-odbc-driver.augmented.sbom.json
content_type: application/json
bucket: mciuploads
permissions: public-read
- command: shell.exec
params:
shell: bash
working_dir: mongosql-odbc-driver
script: |
${prepare_shell}
cp target/release/*.dylib installer/dmg
cp target/release/macos_postinstall installer/dmg
cd installer/dmg
if [ "$RELEASE_VERSION" == "snapshot" ]; then
MINOR_VERSION="0.1"
else
MINOR_VERSION=$(echo "$RELEASE_VERSION" | sed 's|\([0-9]\+[.][0-9]\+\)[.][0-9]\+|\1|')
fi
./build-dmg.sh "$MINOR_VERSION"
"mciuploads release artifacts":
- command: s3.put
params:
build_variants:
- windows-64
aws_key: ${aws_key}
aws_secret: ${aws_secret}
local_file: mongosql-odbc-driver/target/release/atsql.dll
remote_file: mongosql-odbc-driver/artifacts/${version_id}/${build_variant}/release/atsql.dll
bucket: mciuploads
permissions: public-read
content_type: application/octet-stream
- command: s3.put
params:
build_variants:
- windows-64
aws_key: ${aws_key}
aws_secret: ${aws_secret}
local_file: mongosql-odbc-driver/installer/msi/mongoodbc.msi
remote_file: mongosql-odbc-driver/artifacts/${version_id}/${build_variant}/release/mongoodbc.msi
bucket: mciuploads
permissions: public-read
content_type: application/octet-stream
- command: s3.put
params:
build_variants:
- windows-64
aws_key: ${aws_key}
aws_secret: ${aws_secret}
local_file: mongosql-odbc-driver/target/release/atsqls.dll
remote_file: mongosql-odbc-driver/artifacts/${version_id}/${build_variant}/release/atsqls.dll
bucket: mciuploads
permissions: public-read
content_type: application/octet-stream
- command: s3.put
params:
build_variants:
- windows-64
aws_key: ${aws_key}
aws_secret: ${aws_secret}
local_file: mongosql-odbc-driver/target/release/atsql.pdb
remote_file: mongosql-odbc-driver/artifacts/${version_id}/${build_variant}/release/atsql.pdb
bucket: mciuploads
permissions: public-read
content_type: application/octet-stream
- command: s3.put
params:
build_variants:
- ubuntu2204
aws_key: ${aws_key}
aws_secret: ${aws_secret}
local_file: mongosql-odbc-driver/target/release/libatsql.so
remote_file: mongosql-odbc-driver/artifacts/${version_id}/${build_variant}/release/libatsql.so
bucket: mciuploads
permissions: public-read
content_type: application/octet-stream
- command: s3.put
params:
build_variants:
- ubuntu2204
aws_key: ${aws_key}
aws_secret: ${aws_secret}
local_file: mongosql-odbc-driver/release/mongoodbc.tar.gz
remote_file: mongosql-odbc-driver/artifacts/${version_id}/${build_variant}/release/mongoodbc.tar.gz
bucket: mciuploads
permissions: public-read
content_type: application/octet-stream
- command: s3.put
params:
build_variants:
- macos
aws_key: ${aws_key}
aws_secret: ${aws_secret}
local_file: mongosql-odbc-driver/target/release/libatsql.dylib
remote_file: mongosql-odbc-driver/artifacts/${version_id}/${build_variant}/release/libatsql.dylib
bucket: mciuploads
permissions: public-read
content_type: application/octet-stream
- command: s3.put
params:
build_variants:
- macos
aws_key: ${aws_key}
aws_secret: ${aws_secret}
local_file: mongosql-odbc-driver/installer/dmg/mongoodbc.dmg
remote_file: mongosql-odbc-driver/artifacts/${version_id}/${build_variant}/release/mongoodbc.dmg
bucket: mciuploads
permissions: public-read
content_type: application/octet-stream
"upload signed windows artifacts":
- command: s3.put
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
remote_file: mongosql-odbc-driver/artifacts/${version_id}/windows-64/release/mongoodbc-signed.msi
local_file: mongosql-odbc-driver/installer/msi/${MSI_FILENAME}
bucket: mciuploads
permissions: public-read
display_name: mongoodbc-signed.msi
content_type: application/octet-stream
- command: s3.put
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
remote_file: mongosql-odbc-driver/artifacts/${version_id}/windows-64/release/mongoodbc-signed.msi.sha256
local_file: mongosql-odbc-driver/installer/msi/${MSI_FILENAME}.sha256
bucket: mciuploads
permissions: public-read
display_name: mongoodbc-signed.msi.sha256
content_type: application/octet-stream
"upload ubuntu sig file":
- command: s3.put
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
remote_file: mongosql-odbc-driver/artifacts/${version_id}/ubuntu2204/release/mongoodbc.tar.gz.sig
local_file: mongosql-odbc-driver/installer/tgz/mongoodbc.tar.gz.sig
bucket: mciuploads
permissions: public-read
content_type: application/octet-stream
"upload release":
- command: s3.get
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
remote_file: mongosql-odbc-driver/artifacts/${version_id}/windows-64/release/mongoodbc-signed.msi
local_file: mongosql-odbc-driver/release/mongoodbc-signed.msi
bucket: mciuploads
- command: s3.put
params:
aws_key: ${release_aws_key}
aws_secret: ${release_aws_secret}
local_file: mongosql-odbc-driver/release/mongoodbc-signed.msi
remote_file: ${WINDOWS_INSTALLER_PATH}
bucket: translators-connectors-releases
permissions: public-read
content_type: application/octet-stream
display_name: ${MSI_FILENAME}
- command: s3.get
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
remote_file: mongosql-odbc-driver/artifacts/${version_id}/windows-64/release/mongoodbc-signed.msi.sha256
local_file: mongosql-odbc-driver/release/mongoodbc-signed.msi.sha256
bucket: mciuploads
- command: s3.put
params:
aws_key: ${release_aws_key}
aws_secret: ${release_aws_secret}
local_file: mongosql-odbc-driver/release/mongoodbc-signed.msi.sha256
remote_file: ${WINDOWS_INSTALLER_PATH}.sha256
bucket: translators-connectors-releases
permissions: public-read
content_type: application/octet-stream
display_name: ${MSI_FILENAME}.sha256
- command: s3.get
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
remote_file: mongosql-odbc-driver/artifacts/${version_id}/windows-64/release/atsql.dll
local_file: mongosql-odbc-driver/release/atsql.dll
bucket: mciuploads
- command: s3.put
params:
aws_key: ${release_aws_key}
aws_secret: ${release_aws_secret}
local_file: mongosql-odbc-driver/release/atsql.dll
remote_file: mongosql-odbc-driver/windows/${RELEASE_VERSION}/release/atsql.dll
bucket: translators-connectors-releases
permissions: public-read
content_type: application/octet-stream
- command: s3.get
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
remote_file: mongosql-odbc-driver/artifacts/${version_id}/windows-64/release/atsqls.dll
local_file: mongosql-odbc-driver/release/atsqls.dll
bucket: mciuploads
- command: s3.put
params:
aws_key: ${release_aws_key}
aws_secret: ${release_aws_secret}
local_file: mongosql-odbc-driver/release/atsqls.dll
remote_file: mongosql-odbc-driver/windows/${RELEASE_VERSION}/release/atsqls.dll
bucket: translators-connectors-releases
permissions: public-read
content_type: application/octet-stream
- command: s3.get
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}
remote_file: mongosql-odbc-driver/artifacts/${version_id}/windows-64/release/atsql.pdb
local_file: mongosql-odbc-driver/release/atsql.pdb
bucket: mciuploads
- command: s3.put
params:
aws_key: ${release_aws_key}
aws_secret: ${release_aws_secret}
local_file: mongosql-odbc-driver/release/atsql.pdb
remote_file: mongosql-odbc-driver/windows/${RELEASE_VERSION}/release/atsql.pdb
bucket: translators-connectors-releases
permissions: public-read
content_type: application/octet-stream
- command: s3.get
params:
aws_key: ${aws_key}
aws_secret: ${aws_secret}