Skip to content

Commit 15580df

Browse files
authored
PHPC-2366: Invoke drivers-evergreen-tools scripts with bash (#1530)
This also applies bash to PHPC's scripts since it makes no difference. * Replace old Evergreen README content with link to architecture doc * compile.sh and compile-windows.sh are obsolete
1 parent fe9c311 commit 15580df

File tree

7 files changed

+17
-155
lines changed

7 files changed

+17
-155
lines changed

.evergreen/README.md

Lines changed: 6 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,16 @@
1-
# Evergreen Notes
1+
# Evergreen
2+
3+
See [Evergreen Build System Architecture](architecture.md) for more details.
24

35
## mongo-php-toolchain
46

57
[10gen/mongo-php-toolchain](https://github.com/10gen/mongo-php-toolchain) is
68
responsible for building PHP binaries that will be distributed to Evergreen
79
hosts.
810

9-
The Debian and RHEL toolchain scripts are responsible for building individual
10-
toolchains for each variant (e.g. PHP version, architecture). Debian and RHEL
11-
are separate primarily for reasons related to OpenSSL.
12-
1311
## drivers-evergreen-tools
1412

1513
[mongodb-labs/drivers-evergreen-tools](https://github.com/mongodb-labs/drivers-evergreen-tools)
16-
consists of common scripts used by many drivers (e.g. Mongo Orchestration). The
17-
PHP driver clones this during the build process.
18-
19-
In some cases, we have modified scripts in the drivers-evergreen-tools
20-
repository. For instance, the PHP driver uses its own `run-orchestration.sh`
21-
script but still relies on the common `stop-orchestration.sh` script.
22-
23-
## PHP driver Evergreen configuration
24-
25-
`$PROJECT_DIRECTORY` is set by Evergreen and denotes the directory where the PHP
26-
driver is built and tested (i.e. git checkout directory).
27-
28-
Various files have been copied and modified from drivers-evergreen-tools:
29-
30-
* `compile.sh`: This is the main entry point for building the driver and will
31-
either call `compile-unix.sh` and `compile-windows.sh`; however, Windows
32-
builds use a Cygwin environment and are not yet supported.
33-
* `compile-unix.sh`: This includes architecture-specific flags and is used for
34-
both Linux and macOS builds.
35-
* `run-orchestration.sh`: This is very similar to the drivers-evergreen-tools
36-
script but it is customized to use the PHP driver's own topology configs for
37-
Mongo Orchestration.
38-
* `start-orchestration.sh`: This is modified to install an older, tagged
39-
version of Mongo Orchestration. This was necessary for a particular platform,
40-
but may be something to look into in the future.
41-
42-
The PHP driver's `config.yml` is a very stripped down and heavily modified copy
43-
of the drivers-evergreen-tools configuration. This file starts by defining
44-
several functions, which consist of one or more commands (types supported by
45-
Evergreen).
46-
47-
In the case of the `bootstrap mongo-orchestration` function, we execute our
48-
modified `run-orchestration.sh` script and assign various environment variables
49-
which have been defined by our matrix configuration (excluding the
50-
`$PROJECT_DIRECTORY`, which is set by Evergreen itself).
51-
52-
In `run tests`, we also depend on environment variables (e.g. `$MONGODB_URI`)
53-
that originates in `run-orchestration.sh` and are unpacked and assigned by the
54-
`expansions.update` command within the `bootstrap mongo-orchestration` function.
55-
Since Evergreen functions do not return values, assigning environment variables
56-
is the preferred way to communicate down the line.
57-
58-
The `pre` and `post` block define a sequence of functions to run before and
59-
after each build, respectively.
60-
61-
Build variants are the top-level scope in Evergreen. They consist of a list of
62-
tasks (i.e. a square in Evergreen output) and a matrix. The matrix specification
63-
is the combination of all included axes. For instance, the `tests-php5` matrix
64-
may consist of all OS types with PHP5, MongoDB server version 4.0 (we need not
65-
test all server versions), and lastly one or more specific PHP 5.x versions.
66-
Such a matrix might yield a dozen variants, which will be run for each task in
67-
the build variant configuration. The `display_name` option determines how the
68-
build variant (combination of matrix and all tasks) is labeled in the Evergreen
69-
UI.
70-
71-
The `axes` block defines a list of values for a specific group or ID, which is
72-
used when defining a matrix. For instance, if a matrix includes 4 axes, it will
73-
expand to all possible combinations of values within those axes. Care should be
74-
taken to not create too many redundant combinations when defining matrices.
75-
76-
The `exclude_spec` field within a build variant allows us to exclude one or more
77-
combinations from the generated matrix. We typically use this to exclude an
78-
environment we know is not supported (e.g. MongoDB 3.0 and 3.2 on zSeries).
14+
consists of common scripts used by many drivers (e.g. starting
15+
[mongo-orchestration](https://github.com/10gen/mongo-orchestration)). The PHP
16+
driver clones this during the build process.

.evergreen/compile-unix.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22
set -o errexit # Exit the script with error if any of the commands fail
33

44
# Find PHP binary path for the requested version

.evergreen/compile-windows.sh

Lines changed: 0 additions & 48 deletions
This file was deleted.

.evergreen/compile.sh

Lines changed: 0 additions & 29 deletions
This file was deleted.

.evergreen/config/functions.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ functions:
179179
script: |
180180
${PREPARE_SHELL}
181181
SKIP_LEGACY_SHELL=true \
182-
sh ${DRIVERS_TOOLS}/.evergreen/run-orchestration.sh
182+
bash ${DRIVERS_TOOLS}/.evergreen/run-orchestration.sh
183183
# run-orchestration generates expansion file with MONGODB_URI and CRYPT_SHARED_LIB_PATH
184184
- command: expansions.update
185185
params:
@@ -190,7 +190,7 @@ functions:
190190
params:
191191
script: |
192192
${PREPARE_SHELL}
193-
sh ${DRIVERS_TOOLS}/.evergreen/stop-orchestration.sh
193+
bash ${DRIVERS_TOOLS}/.evergreen/stop-orchestration.sh
194194
195195
"run OCSP responder":
196196
- command: shell.exec
@@ -202,7 +202,7 @@ functions:
202202
shell: bash
203203
script: |
204204
${PREPARE_SHELL}
205-
${PROJECT_DIRECTORY}/.evergreen/run-ocsp-responder.sh
205+
bash ${PROJECT_DIRECTORY}/.evergreen/run-ocsp-responder.sh
206206
207207
"run tests":
208208
- command: shell.exec
@@ -221,7 +221,7 @@ functions:
221221
working_dir: "src"
222222
script: |
223223
${PREPARE_SHELL}
224-
sh ${PROJECT_DIRECTORY}/.evergreen/run-tests.sh
224+
bash ${PROJECT_DIRECTORY}/.evergreen/run-tests.sh
225225
226226
"cleanup":
227227
- command: shell.exec
@@ -254,13 +254,14 @@ functions:
254254
${PREPARE_SHELL}
255255
file="${DRIVERS_TOOLS}/.evergreen/install-dependencies.sh"
256256
# Don't use ${file} syntax here because evergreen treats it as an empty expansion.
257-
[ -f "$file" ] && sh $file || echo "$file not available, skipping"
257+
[ -f "$file" ] && bash $file || echo "$file not available, skipping"
258258
259259
"start load balancer":
260260
- command: shell.exec
261261
params:
262262
script: |
263-
MONGODB_URI="${MONGODB_URI}" ${DRIVERS_TOOLS}/.evergreen/run-load-balancer.sh start
263+
MONGODB_URI="${MONGODB_URI}" \
264+
bash ${DRIVERS_TOOLS}/.evergreen/run-load-balancer.sh start
264265
- command: expansions.update
265266
params:
266267
file: lb-expansion.yml
@@ -271,5 +272,5 @@ functions:
271272
script: |
272273
# Only run if a load balancer was started
273274
if [ -n "${SINGLE_MONGOS_LB_URI}" ]; then
274-
${DRIVERS_TOOLS}/.evergreen/run-load-balancer.sh stop
275+
bash ${DRIVERS_TOOLS}/.evergreen/run-load-balancer.sh stop
275276
fi

.evergreen/run-ocsp-responder.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22
set -o errexit
33

44
# Run an mock OCSP responder server if necessary. This script should be invoked

.evergreen/run-tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh
1+
#!/usr/bin/env bash
22
set -o errexit # Exit the script with error if any of the commands fail
33

44
# Supported environment variables

0 commit comments

Comments
 (0)