PYTHON-5050 Clean up handling of installed dependencies across deployment targets (#2071)
This commit is contained in:
parent
7dba1e5dd9
commit
2235b8354c
@ -1,45 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -eu
|
||||
|
||||
# Copy PyMongo's test certificates over driver-evergreen-tools'
|
||||
cp ${PROJECT_DIRECTORY}/test/certificates/* ${DRIVERS_TOOLS}/.evergreen/x509gen/
|
||||
|
||||
# Replace MongoOrchestration's client certificate.
|
||||
cp ${PROJECT_DIRECTORY}/test/certificates/client.pem ${MONGO_ORCHESTRATION_HOME}/lib/client.pem
|
||||
|
||||
if [ -w /etc/hosts ]; then
|
||||
SUDO=""
|
||||
else
|
||||
SUDO="sudo"
|
||||
fi
|
||||
|
||||
# Install just.
|
||||
# On Evergreen jobs, "CI" will be set, and we don't want to write to $HOME.
|
||||
if [ "${CI:-}" == "true" ]; then
|
||||
BIN_DIR=$DRIVERS_TOOLS_BINARIES
|
||||
else
|
||||
BIN_DIR=$HOME/.local/bin
|
||||
fi
|
||||
if [ ! -f $BIN_DIR/just ]; then
|
||||
if [ "Windows_NT" = "${OS:-}" ]; then
|
||||
TARGET="--target x86_64-pc-windows-msvc"
|
||||
else
|
||||
TARGET=""
|
||||
fi
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- $TARGET --to "$BIN_DIR" || {
|
||||
# CARGO_HOME is defined in configure-env.sh
|
||||
export CARGO_HOME=${CARGO_HOME:-$HOME/.cargo/}
|
||||
export RUSTUP_HOME="${CARGO_HOME}/.rustup"
|
||||
. ${DRIVERS_TOOLS}/.evergreen/install-rust.sh
|
||||
cargo install just
|
||||
if [ "Windows_NT" = "${OS:-}" ]; then
|
||||
mv $CARGO_HOME/just.exe $BIN_DIR/just
|
||||
else
|
||||
mv $CARGO_HOME/just $BIN_DIR
|
||||
fi
|
||||
}
|
||||
fi
|
||||
|
||||
# Add 'server' and 'hostname_not_in_cert' as a hostnames
|
||||
echo "127.0.0.1 server" | $SUDO tee -a /etc/hosts
|
||||
echo "127.0.0.1 hostname_not_in_cert" | $SUDO tee -a /etc/hosts
|
||||
@ -8,17 +8,22 @@ export AZUREKMS_VMNAME=${AZUREKMS_VMNAME}
|
||||
export AZUREKMS_PRIVATEKEYPATH=/tmp/testazurekms_privatekey
|
||||
export LIBMONGOCRYPT_URL=https://s3.amazonaws.com/mciuploads/libmongocrypt/debian11/master/latest/libmongocrypt.tar.gz
|
||||
SKIP_SERVERS=1 bash $HERE/setup-encryption.sh
|
||||
tar czf /tmp/mongo-python-driver.tgz .
|
||||
# Set up the remote files to test.
|
||||
git add .
|
||||
git commit -m "add files" || true
|
||||
git archive -o /tmp/mongo-python-driver.tar HEAD
|
||||
tar -rf /tmp/mongo-python-driver.tar libmongocrypt
|
||||
gzip -f /tmp/mongo-python-driver.tar
|
||||
# shellcheck disable=SC2088
|
||||
AZUREKMS_SRC="/tmp/mongo-python-driver.tgz" AZUREKMS_DST="~/" \
|
||||
AZUREKMS_SRC="/tmp/mongo-python-driver.tar.gz" AZUREKMS_DST="~/" \
|
||||
$DRIVERS_TOOLS/.evergreen/csfle/azurekms/copy-file.sh
|
||||
echo "Copying files ... end"
|
||||
echo "Untarring file ... begin"
|
||||
AZUREKMS_CMD="tar xf mongo-python-driver.tgz" \
|
||||
AZUREKMS_CMD="tar xf mongo-python-driver.tar.gz" \
|
||||
$DRIVERS_TOOLS/.evergreen/csfle/azurekms/run-command.sh
|
||||
echo "Untarring file ... end"
|
||||
echo "Running test ... begin"
|
||||
AZUREKMS_CMD="KEY_NAME=\"$AZUREKMS_KEYNAME\" KEY_VAULT_ENDPOINT=\"$AZUREKMS_KEYVAULTENDPOINT\" SUCCESS=true TEST_FLE_AZURE_AUTO=1 ./.evergreen/just.sh test-eg" \
|
||||
AZUREKMS_CMD="KEY_NAME=\"$AZUREKMS_KEYNAME\" KEY_VAULT_ENDPOINT=\"$AZUREKMS_KEYVAULTENDPOINT\" SUCCESS=true TEST_FLE_AZURE_AUTO=1 bash ./.evergreen/just.sh test-eg" \
|
||||
$DRIVERS_TOOLS/.evergreen/csfle/azurekms/run-command.sh
|
||||
echo "Running test ... end"
|
||||
bash $HERE/teardown-encryption.sh
|
||||
|
||||
@ -10,11 +10,16 @@ export GCPKMS_ZONE=${GCPKMS_ZONE}
|
||||
export GCPKMS_INSTANCENAME=${GCPKMS_INSTANCENAME}
|
||||
export LIBMONGOCRYPT_URL=https://s3.amazonaws.com/mciuploads/libmongocrypt/debian11/master/latest/libmongocrypt.tar.gz
|
||||
SKIP_SERVERS=1 bash $HERE/setup-encryption.sh
|
||||
tar czf /tmp/mongo-python-driver.tgz .
|
||||
GCPKMS_SRC=/tmp/mongo-python-driver.tgz GCPKMS_DST=$GCPKMS_INSTANCENAME: $DRIVERS_TOOLS/.evergreen/csfle/gcpkms/copy-file.sh
|
||||
# Set up the remote files to test.
|
||||
git add .
|
||||
git commit -m "add files" || true
|
||||
git archive -o /tmp/mongo-python-driver.tar HEAD
|
||||
tar -rf /tmp/mongo-python-driver.tar libmongocrypt
|
||||
gzip -f /tmp/mongo-python-driver.tar
|
||||
GCPKMS_SRC=/tmp/mongo-python-driver.tar.gz GCPKMS_DST=$GCPKMS_INSTANCENAME: $DRIVERS_TOOLS/.evergreen/csfle/gcpkms/copy-file.sh
|
||||
echo "Copying files ... end"
|
||||
echo "Untarring file ... begin"
|
||||
GCPKMS_CMD="tar xf mongo-python-driver.tgz" $DRIVERS_TOOLS/.evergreen/csfle/gcpkms/run-command.sh
|
||||
GCPKMS_CMD="tar xf mongo-python-driver.tar.gz" $DRIVERS_TOOLS/.evergreen/csfle/gcpkms/run-command.sh
|
||||
echo "Untarring file ... end"
|
||||
echo "Running test ... begin"
|
||||
GCPKMS_CMD="SUCCESS=true TEST_FLE_GCP_AUTO=1 ./.evergreen/just.sh test-eg" $DRIVERS_TOOLS/.evergreen/csfle/gcpkms/run-command.sh
|
||||
|
||||
@ -1,6 +1,42 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
file="$PROJECT_DIRECTORY/.evergreen/install-dependencies.sh"
|
||||
# Don't use ${file} syntax here because evergreen treats it as an empty expansion.
|
||||
[ -f "$file" ] && bash "$file" || echo "$file not available, skipping"
|
||||
|
||||
# On Evergreen jobs, "CI" will be set, and we don't want to write to $HOME.
|
||||
if [ "${CI:-}" == "true" ]; then
|
||||
_BIN_DIR=${DRIVERS_TOOLS_BINARIES:-}
|
||||
else
|
||||
_BIN_DIR=$HOME/.local/bin
|
||||
fi
|
||||
|
||||
|
||||
# Helper function to pip install a dependency using a temporary python env.
|
||||
function _pip_install() {
|
||||
_HERE=$(dirname ${BASH_SOURCE:-$0})
|
||||
. $_HERE/../utils.sh
|
||||
_VENV_PATH=$(mktemp -d)
|
||||
echo "Installing $2 using pip..."
|
||||
createvirtualenv "$(find_python3)" $_VENV_PATH
|
||||
python -m pip install $1
|
||||
ln -s "$(which $2)" $_BIN_DIR/$2
|
||||
echo "Installing $2 using pip... done."
|
||||
}
|
||||
|
||||
|
||||
# Ensure just is installed.
|
||||
if ! command -v just 2>/dev/null; then
|
||||
# On most systems we can install directly.
|
||||
_TARGET=""
|
||||
if [ "Windows_NT" = "${OS:-}" ]; then
|
||||
_TARGET="--target x86_64-pc-windows-msvc"
|
||||
fi
|
||||
echo "Installing just..."
|
||||
mkdir -p "$_BIN_DIR" 2>/dev/null || true
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- $_TARGET --to "$_BIN_DIR" || {
|
||||
_pip_install rust-just just
|
||||
}
|
||||
if ! command -v just 2>/dev/null; then
|
||||
export PATH="$PATH:$_BIN_DIR"
|
||||
fi
|
||||
echo "Installing just... done."
|
||||
fi
|
||||
|
||||
@ -6,12 +6,23 @@ pushd $HERE
|
||||
. env.sh
|
||||
|
||||
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
|
||||
cp -R $PROJECT_DIRECTORY/ $DRIVERS_TOOLS
|
||||
else
|
||||
git clone https://github.com/mongodb-labs/drivers-evergreen-tools.git $DRIVERS_TOOLS
|
||||
fi
|
||||
git clone https://github.com/mongodb-labs/drivers-evergreen-tools.git $DRIVERS_TOOLS
|
||||
echo "{ \"releases\": { \"default\": \"$MONGODB_BINARIES\" }}" >$MONGO_ORCHESTRATION_HOME/orchestration.config
|
||||
|
||||
popd
|
||||
|
||||
# Copy PyMongo's test certificates over driver-evergreen-tools'
|
||||
cp ${PROJECT_DIRECTORY}/test/certificates/* ${DRIVERS_TOOLS}/.evergreen/x509gen/
|
||||
|
||||
# Replace MongoOrchestration's client certificate.
|
||||
cp ${PROJECT_DIRECTORY}/test/certificates/client.pem ${MONGO_ORCHESTRATION_HOME}/lib/client.pem
|
||||
|
||||
if [ -w /etc/hosts ]; then
|
||||
SUDO=""
|
||||
else
|
||||
SUDO="sudo"
|
||||
fi
|
||||
|
||||
# Add 'server' and 'hostname_not_in_cert' as a hostnames
|
||||
echo "127.0.0.1 server" | $SUDO tee -a /etc/hosts
|
||||
echo "127.0.0.1 hostname_not_in_cert" | $SUDO tee -a /etc/hosts
|
||||
|
||||
@ -17,6 +17,8 @@ else
|
||||
BIN_DIR=.venv/bin
|
||||
fi
|
||||
|
||||
. $HERE/install-dependencies.sh
|
||||
|
||||
# Ensure there is a python venv.
|
||||
if [ ! -d $BIN_DIR ]; then
|
||||
. .evergreen/utils.sh
|
||||
|
||||
Loading…
Reference in New Issue
Block a user