Skip to content

Commit

Permalink
test(NODE-4463): move download script
Browse files Browse the repository at this point in the history
  • Loading branch information
durran committed Jul 28, 2022
1 parent 6738b90 commit 8d91856
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 68 deletions.
36 changes: 2 additions & 34 deletions .evergreen/config.in.yml
Original file line number Diff line number Diff line change
Expand Up @@ -818,40 +818,8 @@ functions:
. ./prepare_client_encryption.sh
rm -f ./prepare_client_encryption.sh
MONGODB_VERSION=${VERSION}
if [ -z "$MONGODB_VERSION" ]; then
# default to latest to match behavior of run-orchestration.sh.
MONGODB_VERSION=latest
fi
. $DRIVERS_TOOLS/.evergreen/download-mongodb.sh
get_distro
# get_distro defines $DISTRO.
echo "distro='$DISTRO' version='$MONGODB_VERSION'".
get_mongodb_download_url_for "$DISTRO" "$MONGODB_VERSION"
# get_mongodb_download_url_for defines $MONGO_CRYPT_SHARED_DOWNLOAD_URL and $EXTRACT.
if [ -z "$MONGO_CRYPT_SHARED_DOWNLOAD_URL" ]; then
echo "There is no crypt_shared library for distro='$DISTRO' and version='$MONGODB_VERSION'".
exit 1
else
echo "Downloading crypt_shared package from $MONGO_CRYPT_SHARED_DOWNLOAD_URL"
download_and_extract_crypt_shared "$MONGO_CRYPT_SHARED_DOWNLOAD_URL" "$EXTRACT"
CRYPT_SHARED_LIB_PATH="$(find $(pwd) -maxdepth 1 -type f \
-name 'mongo_crypt_v1.so' -o \
-name 'mongo_crypt_v1.dll' -o \
-name 'mongo_crypt_v1.dylib')"
# Expect that we always find a crypt_shared library file and set the CRYPT_SHARED_LIB_PATH
# environment variable. If we didn't, print an error message and exit.
if [ -z "$CRYPT_SHARED_LIB_PATH" ]; then
echo 'CRYPT_SHARED_LIB_PATH is empty. Exiting.'
exit 1
fi
# If we're on Windows, convert the "cygdrive" path to Windows-style paths.
if [ "Windows_NT" = "$OS" ]; then
CRYPT_SHARED_LIB_PATH=$(cygpath -m $CRYPT_SHARED_LIB_PATH)
fi
echo "CRYPT_SHARED_LIB_PATH: $CRYPT_SHARED_LIB_PATH" > expansion.yml
fi
VERSION=${VERSION} DRIVERS_TOOLS=${DRIVERS_TOOLS} \
bash ${PROJECT_DIRECTORY}/.evergreen/prepare-crypt-shared-lib.sh
MONGODB_URI="${MONGODB_URI}" CRYPT_SHARED_LIB_PATH="${CRYPT_SHARED_LIB_PATH}" \
bash ${PROJECT_DIRECTORY}/.evergreen/run-custom-csfle-tests.sh
Expand Down
36 changes: 2 additions & 34 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -783,40 +783,8 @@ functions:
. ./prepare_client_encryption.sh
rm -f ./prepare_client_encryption.sh
MONGODB_VERSION=${VERSION}
if [ -z "$MONGODB_VERSION" ]; then
# default to latest to match behavior of run-orchestration.sh.
MONGODB_VERSION=latest
fi
. $DRIVERS_TOOLS/.evergreen/download-mongodb.sh
get_distro
# get_distro defines $DISTRO.
echo "distro='$DISTRO' version='$MONGODB_VERSION'".
get_mongodb_download_url_for "$DISTRO" "$MONGODB_VERSION"
# get_mongodb_download_url_for defines $MONGO_CRYPT_SHARED_DOWNLOAD_URL and $EXTRACT.
if [ -z "$MONGO_CRYPT_SHARED_DOWNLOAD_URL" ]; then
echo "There is no crypt_shared library for distro='$DISTRO' and version='$MONGODB_VERSION'".
exit 1
else
echo "Downloading crypt_shared package from $MONGO_CRYPT_SHARED_DOWNLOAD_URL"
download_and_extract_crypt_shared "$MONGO_CRYPT_SHARED_DOWNLOAD_URL" "$EXTRACT"
CRYPT_SHARED_LIB_PATH="$(find $(pwd) -maxdepth 1 -type f \
-name 'mongo_crypt_v1.so' -o \
-name 'mongo_crypt_v1.dll' -o \
-name 'mongo_crypt_v1.dylib')"
# Expect that we always find a crypt_shared library file and set the CRYPT_SHARED_LIB_PATH
# environment variable. If we didn't, print an error message and exit.
if [ -z "$CRYPT_SHARED_LIB_PATH" ]; then
echo 'CRYPT_SHARED_LIB_PATH is empty. Exiting.'
exit 1
fi
# If we're on Windows, convert the "cygdrive" path to Windows-style paths.
if [ "Windows_NT" = "$OS" ]; then
CRYPT_SHARED_LIB_PATH=$(cygpath -m $CRYPT_SHARED_LIB_PATH)
fi
echo "CRYPT_SHARED_LIB_PATH: $CRYPT_SHARED_LIB_PATH" > expansion.yml
fi
VERSION=${VERSION} DRIVERS_TOOLS=${DRIVERS_TOOLS} \
bash ${PROJECT_DIRECTORY}/.evergreen/prepare-crypt-shared-lib.sh
MONGODB_URI="${MONGODB_URI}" CRYPT_SHARED_LIB_PATH="${CRYPT_SHARED_LIB_PATH}" \
bash ${PROJECT_DIRECTORY}/.evergreen/run-custom-csfle-tests.sh
Expand Down
35 changes: 35 additions & 0 deletions .evergreen/prepare-crypt-shared-lib.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
MONGODB_VERSION=${VERSION}
if [ -z "$MONGODB_VERSION" ]; then
# default to latest to match behavior of run-orchestration.sh.
MONGODB_VERSION=latest
fi

. $DRIVERS_TOOLS/.evergreen/download-mongodb.sh
get_distro
# get_distro defines $DISTRO.
echo "distro='$DISTRO' version='$MONGODB_VERSION'".
get_mongodb_download_url_for "$DISTRO" "$MONGODB_VERSION"
# get_mongodb_download_url_for defines $MONGO_CRYPT_SHARED_DOWNLOAD_URL and $EXTRACT.
if [ -z "$MONGO_CRYPT_SHARED_DOWNLOAD_URL" ]; then
echo "There is no crypt_shared library for distro='$DISTRO' and version='$MONGODB_VERSION'".
exit 1
else
echo "Downloading crypt_shared package from $MONGO_CRYPT_SHARED_DOWNLOAD_URL"
download_and_extract_crypt_shared "$MONGO_CRYPT_SHARED_DOWNLOAD_URL" "$EXTRACT"
CRYPT_SHARED_LIB_PATH="$(find $(pwd) -maxdepth 1 -type f \
-name 'mongo_crypt_v1.so' -o \
-name 'mongo_crypt_v1.dll' -o \
-name 'mongo_crypt_v1.dylib')"
# Expect that we always find a crypt_shared library file and set the CRYPT_SHARED_LIB_PATH
# environment variable. If we didn't, print an error message and exit.
if [ -z "$CRYPT_SHARED_LIB_PATH" ]; then
echo 'CRYPT_SHARED_LIB_PATH is empty. Exiting.'
exit 1
fi
# If we're on Windows, convert the "cygdrive" path to Windows-style paths.
if [ "Windows_NT" = "$OS" ]; then
CRYPT_SHARED_LIB_PATH=$(cygpath -m $CRYPT_SHARED_LIB_PATH)
fi
echo "CRYPT_SHARED_LIB_PATH: $CRYPT_SHARED_LIB_PATH"
export $CRYPT_SHARED_LIB_PATH
fi

0 comments on commit 8d91856

Please sign in to comment.