Skip to content

Commit b3ce932

Browse files
authored
PYTHON-5016 Create spawn host helper scripts (mongodb#2036)
1 parent bdaf43c commit b3ce932

File tree

6 files changed

+58
-9
lines changed

6 files changed

+58
-9
lines changed

.evergreen/install-dependencies.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/bin/bash
2-
set -o xtrace # Write all commands first to stderr
3-
set -o errexit # Exit the script with error if any of the commands fail
2+
set -eu
43

54
# Copy PyMongo's test certificates over driver-evergreen-tools'
65
cp ${PROJECT_DIRECTORY}/test/certificates/* ${DRIVERS_TOOLS}/.evergreen/x509gen/
@@ -9,7 +8,7 @@ cp ${PROJECT_DIRECTORY}/test/certificates/* ${DRIVERS_TOOLS}/.evergreen/x509gen/
98
cp ${PROJECT_DIRECTORY}/test/certificates/client.pem ${MONGO_ORCHESTRATION_HOME}/lib/client.pem
109

1110
# Ensure hatch is installed.
12-
bash ${PROJECT_DIRECTORY}/scripts/ensure-hatch.sh
11+
bash ${PROJECT_DIRECTORY}/.evergreen/scripts/ensure-hatch.sh
1312

1413
if [ -w /etc/hosts ]; then
1514
SUDO=""

.evergreen/scripts/configure-env.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
#!/bin/bash -eux
1+
#!/bin/bash
2+
3+
set -eu
24

35
# Get the current unique version of this checkout
46
# shellcheck disable=SC2154
5-
if [ "$is_patch" = "true" ]; then
7+
if [ "${is_patch:-}" = "true" ]; then
68
# shellcheck disable=SC2154
79
CURRENT_VERSION="$(git describe)-patch-$version_id"
810
else
@@ -14,7 +16,7 @@ DRIVERS_TOOLS="$(dirname $PROJECT_DIRECTORY)/drivers-tools"
1416
CARGO_HOME=${CARGO_HOME:-${DRIVERS_TOOLS}/.cargo}
1517

1618
# Python has cygwin path problems on Windows. Detect prospective mongo-orchestration home directory
17-
if [ "Windows_NT" = "$OS" ]; then # Magic variable in cygwin
19+
if [ "Windows_NT" = "${OS:-}" ]; then # Magic variable in cygwin
1820
DRIVERS_TOOLS=$(cygpath -m $DRIVERS_TOOLS)
1921
PROJECT_DIRECTORY=$(cygpath -m $PROJECT_DIRECTORY)
2022
CARGO_HOME=$(cygpath -m $CARGO_HOME)
@@ -59,7 +61,7 @@ export CARGO_HOME="$CARGO_HOME"
5961
export TMPDIR="$MONGO_ORCHESTRATION_HOME/db"
6062
export PATH="$MONGODB_BINARIES:$PATH"
6163
# shellcheck disable=SC2154
62-
export PROJECT="$project"
64+
export PROJECT="${project:-mongo-python-driver}"
6365
export PIP_QUIET=1
6466
EOT
6567

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
#!/bin/bash
2+
set -eu
3+
4+
HERE=$(dirname ${BASH_SOURCE:-$0})
5+
pushd $HERE
6+
. env.sh
27

3-
. src/.evergreen/scripts/env.sh
4-
set -o xtrace
58
rm -rf $DRIVERS_TOOLS
69
if [ "$PROJECT" = "drivers-tools" ]; then
710
# If this was a patch build, doing a fresh clone would not actually test the patch
@@ -10,3 +13,5 @@ else
1013
git clone https://github.com/mongodb-labs/drivers-evergreen-tools.git $DRIVERS_TOOLS
1114
fi
1215
echo "{ \"releases\": { \"default\": \"$MONGODB_BINARIES\" }}" >$MONGO_ORCHESTRATION_HOME/orchestration.config
16+
17+
popd

.evergreen/scripts/setup-system.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
set -eu
4+
5+
HERE=$(dirname ${BASH_SOURCE:-$0})
6+
pushd "$(dirname "$(dirname $HERE)")"
7+
echo "Setting up system..."
8+
bash .evergreen/scripts/configure-env.sh
9+
source .evergreen/scripts/env.sh
10+
bash .evergreen/scripts/prepare-resources.sh
11+
bash $DRIVERS_TOOLS/.evergreen/setup.sh
12+
bash .evergreen/scripts/install-dependencies.sh
13+
popd
14+
echo "Setting up system... done."

.evergreen/setup-spawn-host.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
set -eu
4+
5+
if [ -z "$1" ]
6+
then
7+
echo "Must supply a spawn host URL!"
8+
fi
9+
10+
target=$1
11+
12+
echo "Copying files to $target..."
13+
rsync -az -e ssh --exclude '.git' --filter=':- .gitignore' -r . $target:/home/ec2-user/mongo-python-driver
14+
echo "Copying files to $target... done"
15+
16+
ssh $target /home/ec2-user/mongo-python-driver/.evergreen/scripts/setup-system.sh

.evergreen/sync-spawn-host.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
if [ -z "$1" ]
4+
then
5+
echo "Must supply a spawn host URL!"
6+
fi
7+
8+
target=$1
9+
10+
echo "Syncing files to $target..."
11+
# shellcheck disable=SC2034
12+
fswatch -o . | while read f; do rsync -hazv -e ssh --exclude '.git' --filter=':- .gitignore' -r . $target:/home/ec2-user/mongo-python-driver; done
13+
echo "Syncing files to $target... done."

0 commit comments

Comments
 (0)