Skip to content

Commit 1c7a7fe

Browse files
NoahStappJibola
andauthored
PYTHON-4721 - Create individualized scripts for all shell.exec commands (mongodb#1997)
Co-authored-by: Jib <[email protected]>
1 parent 906d021 commit 1c7a7fe

40 files changed

+683
-430
lines changed

.evergreen/config.yml

Lines changed: 303 additions & 407 deletions
Large diffs are not rendered by default.

.evergreen/hatch.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ else # Set up virtualenv before installing hatch
2929
# Ensure hatch does not write to user or global locations.
3030
touch hatch_config.toml
3131
HATCH_CONFIG=$(pwd)/hatch_config.toml
32-
if [ "Windows_NT" = "$OS" ]; then # Magic variable in cygwin
32+
if [ "Windows_NT" = "${OS:-}" ]; then # Magic variable in cygwin
3333
HATCH_CONFIG=$(cygpath -m "$HATCH_CONFIG")
3434
fi
3535
export HATCH_CONFIG

.evergreen/run-tests.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,18 @@ if [ -z "${NO_EXT:-}" ]; then
5353
fi
5454

5555
if [ "$AUTH" != "noauth" ]; then
56-
if [ ! -z "$TEST_DATA_LAKE" ]; then
56+
if [ -n "$TEST_DATA_LAKE" ]; then
5757
export DB_USER="mhuser"
5858
export DB_PASSWORD="pencil"
59-
elif [ ! -z "$TEST_SERVERLESS" ]; then
60-
source ${DRIVERS_TOOLS}/.evergreen/serverless/secrets-export.sh
59+
elif [ -n "$TEST_SERVERLESS" ]; then
60+
source "${DRIVERS_TOOLS}"/.evergreen/serverless/secrets-export.sh
6161
export DB_USER=$SERVERLESS_ATLAS_USER
6262
export DB_PASSWORD=$SERVERLESS_ATLAS_PASSWORD
6363
export MONGODB_URI="$SERVERLESS_URI"
6464
echo "MONGODB_URI=$MONGODB_URI"
6565
export SINGLE_MONGOS_LB_URI=$MONGODB_URI
6666
export MULTI_MONGOS_LB_URI=$MONGODB_URI
67-
elif [ ! -z "$TEST_AUTH_OIDC" ]; then
67+
elif [ -n "$TEST_AUTH_OIDC" ]; then
6868
export DB_USER=$OIDC_ADMIN_USER
6969
export DB_PASSWORD=$OIDC_ADMIN_PWD
7070
export DB_IP="$MONGODB_URI"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
3+
set -o xtrace
4+
mkdir out_dir
5+
# shellcheck disable=SC2156
6+
find "$MONGO_ORCHESTRATION_HOME" -name \*.log -exec sh -c 'x="{}"; mv $x $PWD/out_dir/$(basename $(dirname $x))_$(basename $x)' \;
7+
tar zcvf mongodb-logs.tar.gz -C out_dir/ .
8+
rm -rf out_dir
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/bin/bash
2+
3+
set -o xtrace
4+
5+
# Enable core dumps if enabled on the machine
6+
# Copied from https://github.com/mongodb/mongo/blob/master/etc/evergreen.yml
7+
if [ -f /proc/self/coredump_filter ]; then
8+
# Set the shell process (and its children processes) to dump ELF headers (bit 4),
9+
# anonymous shared mappings (bit 1), and anonymous private mappings (bit 0).
10+
echo 0x13 >/proc/self/coredump_filter
11+
12+
if [ -f /sbin/sysctl ]; then
13+
# Check that the core pattern is set explicitly on our distro image instead
14+
# of being the OS's default value. This ensures that coredump names are consistent
15+
# across distros and can be picked up by Evergreen.
16+
core_pattern=$(/sbin/sysctl -n "kernel.core_pattern")
17+
if [ "$core_pattern" = "dump_%e.%p.core" ]; then
18+
echo "Enabling coredumps"
19+
ulimit -c unlimited
20+
fi
21+
fi
22+
fi
23+
24+
if [ "$(uname -s)" = "Darwin" ]; then
25+
core_pattern_mac=$(/usr/sbin/sysctl -n "kern.corefile")
26+
if [ "$core_pattern_mac" = "dump_%N.%P.core" ]; then
27+
echo "Enabling coredumps"
28+
ulimit -c unlimited
29+
fi
30+
fi
31+
32+
if [ -n "${skip_crypt_shared}" ]; then
33+
export SKIP_CRYPT_SHARED=1
34+
fi
35+
36+
MONGODB_VERSION=${VERSION} \
37+
TOPOLOGY=${TOPOLOGY} \
38+
AUTH=${AUTH:-noauth} \
39+
SSL=${SSL:-nossl} \
40+
STORAGE_ENGINE=${STORAGE_ENGINE:-} \
41+
DISABLE_TEST_COMMANDS=${DISABLE_TEST_COMMANDS:-} \
42+
ORCHESTRATION_FILE=${ORCHESTRATION_FILE:-} \
43+
REQUIRE_API_VERSION=${REQUIRE_API_VERSION:-} \
44+
LOAD_BALANCER=${LOAD_BALANCER:-} \
45+
bash ${DRIVERS_TOOLS}/.evergreen/run-orchestration.sh
46+
# run-orchestration generates expansion file with the MONGODB_URI for the cluster
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
. .evergreen/scripts/env.sh
4+
set -x
5+
export BASE_SHA="$1"
6+
export HEAD_SHA="$2"
7+
bash .evergreen/run-import-time-test.sh

.evergreen/scripts/cleanup.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
if [ -f "$DRIVERS_TOOLS"/.evergreen/csfle/secrets-export.sh ]; then
4+
. .evergreen/hatch.sh encryption:teardown
5+
fi
6+
rm -rf "${DRIVERS_TOOLS}" || true
7+
rm -f ./secrets-export.sh || true

.evergreen/scripts/configure-env.sh

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash -ex
1+
#!/bin/bash -eux
22

33
# Get the current unique version of this checkout
44
# shellcheck disable=SC2154
@@ -29,7 +29,7 @@ fi
2929
export MONGO_ORCHESTRATION_HOME="$DRIVERS_TOOLS/.evergreen/orchestration"
3030
export MONGODB_BINARIES="$DRIVERS_TOOLS/mongodb/bin"
3131

32-
cat <<EOT > $SCRIPT_DIR/env.sh
32+
cat <<EOT > "$SCRIPT_DIR"/env.sh
3333
set -o errexit
3434
export PROJECT_DIRECTORY="$PROJECT_DIRECTORY"
3535
export CURRENT_VERSION="$CURRENT_VERSION"
@@ -38,6 +38,21 @@ export DRIVERS_TOOLS="$DRIVERS_TOOLS"
3838
export MONGO_ORCHESTRATION_HOME="$MONGO_ORCHESTRATION_HOME"
3939
export MONGODB_BINARIES="$MONGODB_BINARIES"
4040
export PROJECT_DIRECTORY="$PROJECT_DIRECTORY"
41+
export SETDEFAULTENCODING="${SETDEFAULTENCODING:-}"
42+
export SKIP_CSOT_TESTS="${SKIP_CSOT_TESTS:-}"
43+
export MONGODB_STARTED="${MONGODB_STARTED:-}"
44+
export DISABLE_TEST_COMMANDS="${DISABLE_TEST_COMMANDS:-}"
45+
export GREEN_FRAMEWORK="${GREEN_FRAMEWORK:-}"
46+
export NO_EXT="${NO_EXT:-}"
47+
export COVERAGE="${COVERAGE:-}"
48+
export COMPRESSORS="${COMPRESSORS:-}"
49+
export MONGODB_API_VERSION="${MONGODB_API_VERSION:-}"
50+
export SKIP_HATCH="${SKIP_HATCH:-}"
51+
export skip_crypt_shared="${skip_crypt_shared:-}"
52+
export STORAGE_ENGINE="${STORAGE_ENGINE:-}"
53+
export REQUIRE_API_VERSION="${REQUIRE_API_VERSION:-}"
54+
export skip_web_identity_auth_test="${skip_web_identity_auth_test:-}"
55+
export skip_ECS_auth_test="${skip_ECS_auth_test:-}"
4156
4257
export TMPDIR="$MONGO_ORCHESTRATION_HOME/db"
4358
export PATH="$MONGODB_BINARIES:$PATH"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
# Download all the task coverage files.
4+
aws s3 cp --recursive s3://"$1"/coverage/"$2"/"$3"/coverage/ coverage/
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
3+
set +x
4+
. src/.evergreen/scripts/env.sh
5+
# shellcheck disable=SC2044
6+
for filename in $(find $DRIVERS_TOOLS -name \*.json); do
7+
perl -p -i -e "s|ABSOLUTE_PATH_REPLACEMENT_TOKEN|$DRIVERS_TOOLS|g" $filename
8+
done

0 commit comments

Comments
 (0)