Skip to content

Commit b236d27

Browse files
authored
RUST-1348 modularize Evergreen dependency installation script (#695)
1 parent b28cc9c commit b236d27

File tree

5 files changed

+90
-36
lines changed

5 files changed

+90
-36
lines changed

.evergreen/benchmarks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ functions:
111111
working_dir: "src"
112112
script: |
113113
${PREPARE_SHELL}
114-
.evergreen/install-dependencies.sh
114+
.evergreen/install-dependencies.sh rust
115115
116116
"download benchmark data":
117117
command: shell.exec

.evergreen/config.yml

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -333,13 +333,21 @@ functions:
333333
git clone https://github.com/mongodb-labs/drivers-evergreen-tools.git $DRIVERS_TOOLS
334334
echo "{ \"releases\": { \"default\": \"$MONGODB_BINARIES\" }}" > $MONGO_ORCHESTRATION_HOME/orchestration.config
335335
336-
"install dependencies":
336+
"install rust":
337337
command: shell.exec
338338
params:
339339
working_dir: "src"
340340
script: |
341341
${PREPARE_SHELL}
342-
.evergreen/install-dependencies.sh
342+
.evergreen/install-dependencies.sh rust
343+
344+
"install junit dependencies":
345+
command: shell.exec
346+
params:
347+
working_dir: "src"
348+
script: |
349+
${PREPARE_SHELL}
350+
.evergreen/install-dependencies.sh junit-dependencies
343351
344352
"bootstrap mongo-orchestration":
345353
- command: shell.exec
@@ -587,6 +595,7 @@ functions:
587595
working_dir: "src"
588596
script: |
589597
${PREPARE_SHELL}
598+
.evergreen/install-dependencies.sh mdbook
590599
manual/test.sh
591600
592601
"upload-mo-artifacts":
@@ -700,7 +709,7 @@ pre:
700709
- func: "fix absolute paths"
701710
- func: "init test-results"
702711
- func: "make files executable"
703-
- func: "install dependencies"
712+
- func: "install rust"
704713

705714
post:
706715
- func: "stop load balancer"
@@ -713,6 +722,7 @@ tasks:
713722
- name: "test-3.6-standalone"
714723
tags: ["3.6", "standalone"]
715724
commands:
725+
- func: "install junit dependencies"
716726
- func: "bootstrap mongo-orchestration"
717727
vars:
718728
MONGODB_VERSION: "3.6"
@@ -722,6 +732,7 @@ tasks:
722732
- name: "test-3.6-replica_set"
723733
tags: ["3.6", "replica_set"]
724734
commands:
735+
- func: "install junit dependencies"
725736
- func: "bootstrap mongo-orchestration"
726737
vars:
727738
MONGODB_VERSION: "3.6"
@@ -731,6 +742,7 @@ tasks:
731742
- name: "test-3.6-sharded_cluster"
732743
tags: ["3.6", "sharded_cluster"]
733744
commands:
745+
- func: "install junit dependencies"
734746
- func: "bootstrap mongo-orchestration"
735747
vars:
736748
MONGODB_VERSION: "3.6"
@@ -740,6 +752,7 @@ tasks:
740752
- name: "test-4.0-standalone"
741753
tags: ["4.0", "standalone"]
742754
commands:
755+
- func: "install junit dependencies"
743756
- func: "bootstrap mongo-orchestration"
744757
vars:
745758
MONGODB_VERSION: "4.0"
@@ -749,6 +762,7 @@ tasks:
749762
- name: "test-4.0-replica_set"
750763
tags: ["4.0", "replica_set"]
751764
commands:
765+
- func: "install junit dependencies"
752766
- func: "bootstrap mongo-orchestration"
753767
vars:
754768
MONGODB_VERSION: "4.0"
@@ -758,6 +772,7 @@ tasks:
758772
- name: "test-4.0-sharded_cluster"
759773
tags: ["4.0", "sharded_cluster"]
760774
commands:
775+
- func: "install junit dependencies"
761776
- func: "bootstrap mongo-orchestration"
762777
vars:
763778
MONGODB_VERSION: "4.0"
@@ -767,6 +782,7 @@ tasks:
767782
- name: "test-4.2-standalone"
768783
tags: ["4.2", "standalone"]
769784
commands:
785+
- func: "install junit dependencies"
770786
- func: "bootstrap mongo-orchestration"
771787
vars:
772788
MONGODB_VERSION: "4.2"
@@ -776,6 +792,7 @@ tasks:
776792
- name: "test-4.2-replica_set"
777793
tags: ["4.2", "replica_set"]
778794
commands:
795+
- func: "install junit dependencies"
779796
- func: "bootstrap mongo-orchestration"
780797
vars:
781798
MONGODB_VERSION: "4.2"
@@ -785,6 +802,7 @@ tasks:
785802
- name: "test-4.2-sharded_cluster"
786803
tags: ["4.2", "sharded_cluster"]
787804
commands:
805+
- func: "install junit dependencies"
788806
- func: "bootstrap mongo-orchestration"
789807
vars:
790808
MONGODB_VERSION: "4.2"
@@ -794,6 +812,7 @@ tasks:
794812
- name: "test-4.4-standalone"
795813
tags: ["4.4", "standalone"]
796814
commands:
815+
- func: "install junit dependencies"
797816
- func: "bootstrap mongo-orchestration"
798817
vars:
799818
MONGODB_VERSION: "4.4"
@@ -803,6 +822,7 @@ tasks:
803822
- name: "test-4.4-replica_set"
804823
tags: ["4.4", "replica_set"]
805824
commands:
825+
- func: "install junit dependencies"
806826
- func: "bootstrap mongo-orchestration"
807827
vars:
808828
MONGODB_VERSION: "4.4"
@@ -812,6 +832,7 @@ tasks:
812832
- name: "test-4.4-sharded_cluster"
813833
tags: ["4.4", "sharded_cluster"]
814834
commands:
835+
- func: "install junit dependencies"
815836
- func: "bootstrap mongo-orchestration"
816837
vars:
817838
MONGODB_VERSION: "4.4"
@@ -839,6 +860,7 @@ tasks:
839860
- name: "test-5.0-standalone"
840861
tags: ["5.0", "standalone"]
841862
commands:
863+
- func: "install junit dependencies"
842864
- func: "bootstrap mongo-orchestration"
843865
vars:
844866
MONGODB_VERSION: "5.0"
@@ -848,6 +870,7 @@ tasks:
848870
- name: "test-5.0-replica_set"
849871
tags: ["5.0", "replica_set"]
850872
commands:
873+
- func: "install junit dependencies"
851874
- func: "bootstrap mongo-orchestration"
852875
vars:
853876
MONGODB_VERSION: "5.0"
@@ -857,6 +880,7 @@ tasks:
857880
- name: "test-5.0-sharded_cluster"
858881
tags: ["5.0", "sharded_cluster"]
859882
commands:
883+
- func: "install junit dependencies"
860884
- func: "bootstrap mongo-orchestration"
861885
vars:
862886
MONGODB_VERSION: "5.0"
@@ -866,6 +890,7 @@ tasks:
866890
- name: "test-5.0-load_balancer"
867891
tags: ["5.0", "load_balancer"]
868892
commands:
893+
- func: "install junit dependencies"
869894
- func: "bootstrap mongo-orchestration"
870895
vars:
871896
MONGODB_VERSION: "5.0"
@@ -895,6 +920,7 @@ tasks:
895920
- name: "test-6.0-standalone"
896921
tags: ["6.0", "standalone"]
897922
commands:
923+
- func: "install junit dependencies"
898924
- func: "bootstrap mongo-orchestration"
899925
vars:
900926
MONGODB_VERSION: "6.0"
@@ -904,6 +930,7 @@ tasks:
904930
- name: "test-6.0-replica_set"
905931
tags: ["6.0", "replica_set"]
906932
commands:
933+
- func: "install junit dependencies"
907934
- func: "bootstrap mongo-orchestration"
908935
vars:
909936
MONGODB_VERSION: "6.0"
@@ -913,6 +940,7 @@ tasks:
913940
- name: "test-6.0-sharded_cluster"
914941
tags: ["6.0", "sharded_cluster"]
915942
commands:
943+
- func: "install junit dependencies"
916944
- func: "bootstrap mongo-orchestration"
917945
vars:
918946
MONGODB_VERSION: "6.0"
@@ -922,6 +950,7 @@ tasks:
922950
- name: "test-6.0-load_balancer"
923951
tags: ["6.0", "load_balancer"]
924952
commands:
953+
- func: "install junit dependencies"
925954
- func: "bootstrap mongo-orchestration"
926955
vars:
927956
MONGODB_VERSION: "6.0"
@@ -951,6 +980,7 @@ tasks:
951980
- name: "test-rapid-standalone"
952981
tags: ["rapid", "standalone"]
953982
commands:
983+
- func: "install junit dependencies"
954984
- func: "bootstrap mongo-orchestration"
955985
vars:
956986
MONGODB_VERSION: "rapid"
@@ -960,6 +990,7 @@ tasks:
960990
- name: "test-rapid-replica_set"
961991
tags: ["rapid", "replica_set"]
962992
commands:
993+
- func: "install junit dependencies"
963994
- func: "bootstrap mongo-orchestration"
964995
vars:
965996
MONGODB_VERSION: "rapid"
@@ -969,6 +1000,7 @@ tasks:
9691000
- name: "test-rapid-sharded_cluster"
9701001
tags: ["rapid", "sharded_cluster"]
9711002
commands:
1003+
- func: "install junit dependencies"
9721004
- func: "bootstrap mongo-orchestration"
9731005
vars:
9741006
MONGODB_VERSION: "rapid"
@@ -978,6 +1010,7 @@ tasks:
9781010
- name: "test-rapid-load_balancer"
9791011
tags: ["rapid", "load_balancer"]
9801012
commands:
1013+
- func: "install junit dependencies"
9811014
- func: "bootstrap mongo-orchestration"
9821015
vars:
9831016
MONGODB_VERSION: "rapid"
@@ -1007,6 +1040,7 @@ tasks:
10071040
- name: "test-latest-standalone"
10081041
tags: ["latest", "standalone"]
10091042
commands:
1043+
- func: "install junit dependencies"
10101044
- func: "bootstrap mongo-orchestration"
10111045
vars:
10121046
MONGODB_VERSION: "latest"
@@ -1016,6 +1050,7 @@ tasks:
10161050
- name: "test-latest-replica_set"
10171051
tags: ["latest", "replica_set"]
10181052
commands:
1053+
- func: "install junit dependencies"
10191054
- func: "bootstrap mongo-orchestration"
10201055
vars:
10211056
MONGODB_VERSION: "latest"
@@ -1025,6 +1060,7 @@ tasks:
10251060
- name: "test-latest-sharded_cluster"
10261061
tags: ["latest", "sharded_cluster"]
10271062
commands:
1063+
- func: "install junit dependencies"
10281064
- func: "bootstrap mongo-orchestration"
10291065
vars:
10301066
MONGODB_VERSION: "latest"
@@ -1034,6 +1070,7 @@ tasks:
10341070
- name: "test-latest-load_balancer"
10351071
tags: ["latest", "load_balancer"]
10361072
commands:
1073+
- func: "install junit dependencies"
10371074
- func: "bootstrap mongo-orchestration"
10381075
vars:
10391076
MONGODB_VERSION: "latest"
@@ -1068,6 +1105,7 @@ tasks:
10681105
- name: "test-serverless"
10691106
tags: ["serverless"]
10701107
commands:
1108+
- func: "install junit dependencies"
10711109
- func: "run serverless tests"
10721110

10731111
- name: "test-atlas-connectivity"
@@ -1077,6 +1115,7 @@ tasks:
10771115

10781116
- name: "test-x509-auth"
10791117
commands:
1118+
- func: "install junit dependencies"
10801119
- func: "bootstrap mongo-orchestration"
10811120
vars:
10821121
MONGODB_VERSION: "4.4"
@@ -1612,7 +1651,7 @@ task_groups:
16121651
- func: "fix absolute paths"
16131652
- func: "init test-results"
16141653
- func: "make files executable"
1615-
- func: "install dependencies"
1654+
- func: "install rust"
16161655
- command: shell.exec
16171656
params:
16181657
shell: "bash"

.evergreen/install-dependencies.sh

Lines changed: 42 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#!/bin/bash
22

3+
# this script accepts one or more of the following arguments: `rust`, `mdbook`, `junit-dependencies`.
4+
# the corresponding dependencies will be installed in the order they are specified.
5+
36
set -o xtrace
47
set -o errexit
58

@@ -14,39 +17,49 @@ if [ "Windows_NT" == "$OS" ]; then
1417
export CARGO_HOME=$(cygpath ${CARGO_HOME} --windows)
1518
fi
1619

17-
curl https://sh.rustup.rs -sSf | sh -s -- -y --no-modify-path $DEFAULT_HOST_OPTIONS
18-
19-
# This file is not created by default on Windows
20-
echo 'export PATH="$PATH:${CARGO_HOME}/bin"' >> ${CARGO_HOME}/env
21-
echo "export CARGO_NET_GIT_FETCH_WITH_CLI=true" >> ${CARGO_HOME}/env
22-
23-
source ${CARGO_HOME}/env
20+
for arg; do
21+
if [ $arg == "rust" ]; then
22+
curl https://sh.rustup.rs -sSf | sh -s -- -y --no-modify-path $DEFAULT_HOST_OPTIONS
2423

25-
# Install nightly rustfmt
26-
rustup toolchain install nightly -c rustfmt
24+
# This file is not created by default on Windows
25+
echo 'export PATH="$PATH:${CARGO_HOME}/bin"' >> ${CARGO_HOME}/env
26+
echo "export CARGO_NET_GIT_FETCH_WITH_CLI=true" >> ${CARGO_HOME}/env
2727

28-
# Install tool for converting cargo test output to junit
29-
cargo install cargo2junit
28+
source .evergreen/configure-rust.sh
29+
rustup toolchain install nightly -c rustfmt
30+
elif [ $arg == "mdbook" ]; then
31+
source ${CARGO_HOME}/env
32+
# Install the manual rendering tool
33+
cargo install mdbook
34+
elif [ $arg == "junit-dependencies" ]; then
35+
source ${CARGO_HOME}/env
36+
# Install tool for converting cargo test output to junit
37+
cargo install cargo2junit
3038

31-
# Install the manual rendering tool
32-
cargo install mdbook
39+
# install npm/node
40+
./.evergreen/install-node.sh
3341

34-
# install npm/node
35-
./.evergreen/install-node.sh
42+
source ./.evergreen/env.sh
3643

37-
source ./.evergreen/env.sh
44+
# Install tool for merging different junit reports into a single one
45+
set +o errexit
46+
set -o pipefail
3847

39-
# Install tool for merging different junit reports into a single one
40-
set +o errexit
41-
set -o pipefail
42-
43-
npm install -g junit-report-merger --cache $(mktemp -d) 2>&1 | tee npm-install-output
44-
RESULT=$?
45-
MATCH=$(grep -o '/\S*-debug.log' npm-install-output)
46-
if [[ $MATCH != "" ]]; then
47-
echo ===== BEGIN NPM LOG =====
48-
cat $MATCH
49-
echo ===== END NPM LOG =====
50-
fi
48+
npm install -g junit-report-merger --cache $(mktemp -d) 2>&1 | tee npm-install-output
49+
RESULT=$?
50+
MATCH=$(grep -o '/\S*-debug.log' npm-install-output)
51+
if [[ $MATCH != "" ]]; then
52+
echo ===== BEGIN NPM LOG =====
53+
cat $MATCH
54+
echo ===== END NPM LOG =====
55+
fi
5156

52-
exit $RESULT
57+
set -o errexit
58+
if [ $RESULT -ne 0 ]; then
59+
exit $RESULT
60+
fi
61+
else
62+
echo Missing/unknown install option: "$arg"
63+
exit 1
64+
fi
65+
done

.evergreen/releases.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ functions:
3737
working_dir: "src"
3838
script: |
3939
${PREPARE_SHELL}
40-
.evergreen/install-dependencies.sh
40+
.evergreen/install-dependencies.sh rust
4141
4242
"publish release":
4343
- command: shell.exec

0 commit comments

Comments
 (0)