Skip to content

Commit

Permalink
GODRIVER-3367 Use subprocess.exec for Evergreen functions (mongodb#1847)
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 authored Oct 8, 2024
1 parent 24153e5 commit 78b0f61
Show file tree
Hide file tree
Showing 8 changed files with 288 additions and 307 deletions.
515 changes: 216 additions & 299 deletions .evergreen/config.yml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions .evergreen/setup-system.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export GOPATH="$GOPATH"
export GOCACHE="$GOCACHE"
export DRIVERS_TOOLS="$DRIVERS_TOOLS"
export PROJECT_DIRECTORY="$PROJECT_DIRECTORY"
export MONGODB_BINARIES="$MONGODB_BINARIES"
export PATH="$PATH"
EOT

Expand Down
4 changes: 3 additions & 1 deletion Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,14 @@ tasks:
status:
- test -d install || test -d /cygdrive/c/libmongocrypt/bin

run-docker: bash etc/run_docker.sh
run-docker: bash etc/run_docker.sh {{.CLI_ARGS}}

run-fuzz: bash etc/run-fuzz.sh

cherry-picker: bash etc/cherry-picker.sh

pr-task: bash etc/pr-task.sh

# Lint with various GOOS and GOARCH tasks to catch static analysis failures that may only affect
# specific operating systems or architectures. For example, staticcheck will only check for 64-bit
# alignment of atomically accessed variables on 32-bit architectures (see
Expand Down
2 changes: 1 addition & 1 deletion etc/docker_entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ export PATH="$MONGODB_BINARIES:$HOME/go/bin:$PATH"
task setup-test

# Run the test.
task evg-test
task $TASKFILE_TARGET
10 changes: 6 additions & 4 deletions etc/golangci-lint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env bash
set -ex

# Keep this in sync with go version used in static-analysis Evergreen build variant.
GO_VERSION=1.22.8
GOLANGCI_LINT_VERSION=1.60.1

Expand All @@ -10,12 +11,13 @@ export GOOS=
GOARCH_ORIG=${GOARCH:-}
export GOARCH=

# Keep this in sync with go version used in static-analysis Evergreen build variant.
go install golang.org/dl/go$GO_VERSION@latest
go$GO_VERSION download
PATH="$(go$GO_VERSION env GOROOT)/bin:$PATH"
go${GO_VERSION} download
GOROOT="$(go${GO_VERSION} env GOROOT)"
PATH="$GOROOT/bin:$PATH"
export PATH
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v$GOLANGCI_LINT_VERSION
export GOROOT
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v${GOLANGCI_LINT_VERSION}

export GOOS=$GOOS_ORIG
export GOARCH=$GOARCH_ORIG
Expand Down
30 changes: 30 additions & 0 deletions etc/pr-task.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
set -eu

VARLIST=(
PR_TASK
COMMIT
DRIVERS_TOOLS
)

# Ensure that all variables required to run the test are set, otherwise throw
# an error.
for VARNAME in "${VARLIST[@]}"; do
[[ -z "${!VARNAME:-}" ]] && echo "ERROR: $VARNAME not set" && exit 1;
done

case $PR_TASK in
apply-labels)
CONFIG=$(pwd)/.github/labeler.yml
SCRIPT="${DRIVERS_TOOLS}/.evergreen/github_app/apply-labels.sh"
bash $SCRIPT -l $CONFIG -h $COMMIT -o "mongodb" -n "mongo-go-driver"
;;
assign-reviewer)
CONFIG=$(pwd)/.github/reviewers.txt
SCRIPT="${DRIVERS_TOOLS}/.evergreen/github_app/assign-reviewer.sh"
bash $SCRIPT -p $CONFIG -h $COMMIT -o "mongodb" -n "mongo-go-driver"
;;
backport-pr)
bash ${DRIVERS_TOOLS}/.evergreen/github_app/backport-pr.sh mongodb mongo-go-driver $COMMIT
;;
esac
10 changes: 10 additions & 0 deletions etc/run-mongodb-aws-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ set -o errexit # Exit the script with error if any of the commands fail

echo "Running MONGODB-AWS authentication tests"

if [ "$1" == "ec2" ] && [ "${SKIP_EC2_AUTH_TEST:-}" == "true" ]; then
echo "This platform does not support the EC2 auth test, skipping..."
exit 0
fi

if [ "$1" == "web-identity" ] && [ "${SKIP_WEB_IDENTITY_AUTH_TEST:-}" == "true" ]; then
echo "This platform does not support the web identity auth test, skipping..."
exit 0
fi

# Handle credentials and environment setup.
. $DRIVERS_TOOLS/.evergreen/auth_aws/aws_setup.sh $1

Expand Down
23 changes: 21 additions & 2 deletions etc/setup-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,20 @@ case ${1:-} in
atlas-connect)
. $DRIVERS_TOOLS/.evergreen/secrets_handling/setup-secrets.sh drivers/atlas_connect
;;
load-balancer)
# Verify that the required LB URI expansions are set to ensure that the test runner can correctly connect to
# the LBs.
if [ -z "${SINGLE_MONGOS_LB_URI}" ]; then
echo "SINGLE_MONGOS_LB_URI must be set for testing against LBs"
exit 1
fi
if [ -z "${MULTI_MONGOS_LB_URI}" ]; then
echo "MULTI_MONGOS_LB_URI must be set for testing against LBs"
exit 1
fi
MONGODB_URI="${SINGLE_MONGOS_LB_URI}"
LOAD_BALANCER="true"
;;
esac

# Handle encryption.
Expand All @@ -51,8 +65,8 @@ if [[ "${GO_BUILD_TAGS}" =~ cse ]]; then
LD_LIBRARY_PATH=$(pwd)/install/libmongocrypt/lib64

if [ "$(uname -s)" = "Darwin" ]; then
PKG_CONFIG_PATH=$(pwd)/install/libmongocrypt/lib/pkgconfig
DYLD_FALLBACK_LIBRARY_PATH=$(pwd)/install/libmongocrypt/lib
PKG_CONFIG_PATH=$(pwd)/install/libmongocrypt/lib/pkgconfig
DYLD_FALLBACK_LIBRARY_PATH=$(pwd)/install/libmongocrypt/lib
fi

if [ "${SKIP_CRYPT_SHARED_LIB:-''}" = "true" ]; then
Expand Down Expand Up @@ -116,6 +130,11 @@ if [ -n "${SERVERLESS:-}" ]; then
echo "SERVERLESS_ATLAS_PASSWORD=$SERVERLESS_ATLAS_PASSWORD" >> .test.env
fi

if [ -n "${LOAD_BALANCER:-}" ];then
echo "SINGLE_MONGOS_LB_URI=${SINGLE_MONGOS_LB_URI}" >> .test.env
echo "MULTI_MONGOS_LB_URI=${MULTI_MONGOS_LB_URI}" >> .test.env
fi

# Add secrets to the test file.
if [ -f "secrets-export.sh" ]; then
while read p; do
Expand Down

0 comments on commit 78b0f61

Please sign in to comment.