diff --git a/.evergreen/install-dependencies.sh b/.evergreen/install-dependencies.sh index 4c0541a4e2..d90ff4ab45 100755 --- a/.evergreen/install-dependencies.sh +++ b/.evergreen/install-dependencies.sh @@ -1,6 +1,5 @@ #!/bin/bash -set -o xtrace # Write all commands first to stderr -set -o errexit # Exit the script with error if any of the commands fail +set -eu # Copy PyMongo's test certificates over driver-evergreen-tools' cp ${PROJECT_DIRECTORY}/test/certificates/* ${DRIVERS_TOOLS}/.evergreen/x509gen/ @@ -9,7 +8,7 @@ cp ${PROJECT_DIRECTORY}/test/certificates/* ${DRIVERS_TOOLS}/.evergreen/x509gen/ cp ${PROJECT_DIRECTORY}/test/certificates/client.pem ${MONGO_ORCHESTRATION_HOME}/lib/client.pem # Ensure hatch is installed. -bash ${PROJECT_DIRECTORY}/scripts/ensure-hatch.sh +bash ${PROJECT_DIRECTORY}/.evergreen/scripts/ensure-hatch.sh if [ -w /etc/hosts ]; then SUDO="" diff --git a/.evergreen/scripts/configure-env.sh b/.evergreen/scripts/configure-env.sh index 313f4c3c92..e0c845a333 100755 --- a/.evergreen/scripts/configure-env.sh +++ b/.evergreen/scripts/configure-env.sh @@ -1,8 +1,10 @@ -#!/bin/bash -eux +#!/bin/bash + +set -eu # Get the current unique version of this checkout # shellcheck disable=SC2154 -if [ "$is_patch" = "true" ]; then +if [ "${is_patch:-}" = "true" ]; then # shellcheck disable=SC2154 CURRENT_VERSION="$(git describe)-patch-$version_id" else @@ -14,7 +16,7 @@ DRIVERS_TOOLS="$(dirname $PROJECT_DIRECTORY)/drivers-tools" CARGO_HOME=${CARGO_HOME:-${DRIVERS_TOOLS}/.cargo} # Python has cygwin path problems on Windows. Detect prospective mongo-orchestration home directory -if [ "Windows_NT" = "$OS" ]; then # Magic variable in cygwin +if [ "Windows_NT" = "${OS:-}" ]; then # Magic variable in cygwin DRIVERS_TOOLS=$(cygpath -m $DRIVERS_TOOLS) PROJECT_DIRECTORY=$(cygpath -m $PROJECT_DIRECTORY) CARGO_HOME=$(cygpath -m $CARGO_HOME) @@ -59,7 +61,7 @@ export CARGO_HOME="$CARGO_HOME" export TMPDIR="$MONGO_ORCHESTRATION_HOME/db" export PATH="$MONGODB_BINARIES:$PATH" # shellcheck disable=SC2154 -export PROJECT="$project" +export PROJECT="${project:-mongo-python-driver}" export PIP_QUIET=1 EOT diff --git a/.evergreen/scripts/prepare-resources.sh b/.evergreen/scripts/prepare-resources.sh index 33394b55ff..3cfa2c4efd 100755 --- a/.evergreen/scripts/prepare-resources.sh +++ b/.evergreen/scripts/prepare-resources.sh @@ -1,7 +1,10 @@ #!/bin/bash +set -eu + +HERE=$(dirname ${BASH_SOURCE:-$0}) +pushd $HERE +. env.sh -. src/.evergreen/scripts/env.sh -set -o xtrace rm -rf $DRIVERS_TOOLS if [ "$PROJECT" = "drivers-tools" ]; then # If this was a patch build, doing a fresh clone would not actually test the patch @@ -10,3 +13,5 @@ else git clone https://github.com/mongodb-labs/drivers-evergreen-tools.git $DRIVERS_TOOLS fi echo "{ \"releases\": { \"default\": \"$MONGODB_BINARIES\" }}" >$MONGO_ORCHESTRATION_HOME/orchestration.config + +popd diff --git a/.evergreen/scripts/setup-system.sh b/.evergreen/scripts/setup-system.sh new file mode 100755 index 0000000000..d78d924f6b --- /dev/null +++ b/.evergreen/scripts/setup-system.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +set -eu + +HERE=$(dirname ${BASH_SOURCE:-$0}) +pushd "$(dirname "$(dirname $HERE)")" +echo "Setting up system..." +bash .evergreen/scripts/configure-env.sh +source .evergreen/scripts/env.sh +bash .evergreen/scripts/prepare-resources.sh +bash $DRIVERS_TOOLS/.evergreen/setup.sh +bash .evergreen/scripts/install-dependencies.sh +popd +echo "Setting up system... done." diff --git a/.evergreen/setup-spawn-host.sh b/.evergreen/setup-spawn-host.sh new file mode 100755 index 0000000000..4de2153d51 --- /dev/null +++ b/.evergreen/setup-spawn-host.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +set -eu + +if [ -z "$1" ] + then + echo "Must supply a spawn host URL!" +fi + +target=$1 + +echo "Copying files to $target..." +rsync -az -e ssh --exclude '.git' --filter=':- .gitignore' -r . $target:/home/ec2-user/mongo-python-driver +echo "Copying files to $target... done" + +ssh $target /home/ec2-user/mongo-python-driver/.evergreen/scripts/setup-system.sh diff --git a/.evergreen/sync-spawn-host.sh b/.evergreen/sync-spawn-host.sh new file mode 100755 index 0000000000..4c3e276d41 --- /dev/null +++ b/.evergreen/sync-spawn-host.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +if [ -z "$1" ] + then + echo "Must supply a spawn host URL!" +fi + +target=$1 + +echo "Syncing files to $target..." +# shellcheck disable=SC2034 +fswatch -o . | while read f; do rsync -hazv -e ssh --exclude '.git' --filter=':- .gitignore' -r . $target:/home/ec2-user/mongo-python-driver; done +echo "Syncing files to $target... done."