Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GODRIVER-3338 Remove usage of PREPARE_SHELL in Evergreen Config #1843

Merged
merged 79 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
b8a0a0f
GODRIVER-3338 Remove usage of PREPARE_SHELL in Evergreen Config
blink1073 Sep 17, 2024
9b5f26d
fix add_to_path
blink1073 Sep 17, 2024
30416e4
set default OS
blink1073 Sep 18, 2024
1693342
prepend the path
blink1073 Sep 18, 2024
d855ae3
export GOPATH
blink1073 Sep 18, 2024
c9c1554
fix expansion
blink1073 Sep 18, 2024
d501990
cleanup
blink1073 Sep 18, 2024
f4a4f08
fix var handling
blink1073 Sep 18, 2024
611b3e6
fix var handling
blink1073 Sep 18, 2024
195715e
more setup fixes
blink1073 Sep 18, 2024
f703167
more debug
blink1073 Sep 18, 2024
517fa62
fix handling of auth
blink1073 Sep 18, 2024
de4af4a
debug
blink1073 Sep 18, 2024
57fa643
more debug
blink1073 Sep 18, 2024
43b80da
fix handling of args
blink1073 Sep 18, 2024
d03548c
try again
blink1073 Sep 18, 2024
e3a2cdb
try again
blink1073 Sep 18, 2024
8a6d40f
fixup
blink1073 Sep 18, 2024
404700d
try again
blink1073 Sep 18, 2024
0efa5df
try again
blink1073 Sep 18, 2024
a728e9c
try again
blink1073 Sep 18, 2024
848db91
fix windows
blink1073 Sep 18, 2024
f601c6d
fix syntax
blink1073 Sep 18, 2024
f98e416
cleanup
blink1073 Sep 18, 2024
f69c89e
fix gcc
blink1073 Sep 18, 2024
22aa3b6
add wrapper script
blink1073 Sep 19, 2024
b651bb6
add wrapper script
blink1073 Sep 19, 2024
0074835
fix wrapper sript
blink1073 Sep 19, 2024
36c55f6
cleanup
blink1073 Sep 19, 2024
f5bec19
refactor setup-env.sh
blink1073 Sep 19, 2024
ad78043
cleanup
blink1073 Sep 19, 2024
6c8f9b4
trace the variable value
blink1073 Sep 19, 2024
5316909
more debug
blink1073 Sep 19, 2024
dafbe54
cleanup
blink1073 Sep 20, 2024
85d5914
try again
blink1073 Sep 20, 2024
169d5b0
more fixups
blink1073 Sep 20, 2024
3d0b008
more fixups
blink1073 Sep 20, 2024
8d6bba3
fix kms and serverless
blink1073 Sep 20, 2024
8d0435d
fix kms
blink1073 Sep 20, 2024
6f3f8bf
fix kmstest
blink1073 Sep 20, 2024
58f53a8
wait for the servers
blink1073 Sep 20, 2024
612ca2e
debug
blink1073 Sep 20, 2024
eb69a89
remove extra check
blink1073 Sep 20, 2024
2da39c7
debug
blink1073 Sep 20, 2024
ffe4a90
debug
blink1073 Sep 20, 2024
4b726ba
fix serverless
blink1073 Sep 20, 2024
56beec3
fix serverless
blink1073 Sep 20, 2024
2f879c1
fix serverless
blink1073 Sep 20, 2024
2163374
fix auth
blink1073 Sep 20, 2024
6d3ffb6
rename to setup-system and allow to run locally
blink1073 Sep 22, 2024
56a171e
allow system setup to run locally
blink1073 Sep 22, 2024
b5f99ee
fix GOPATH
blink1073 Sep 22, 2024
53d9ede
windows fix
blink1073 Sep 22, 2024
295527d
fixup
blink1073 Sep 22, 2024
607908f
fix paths
blink1073 Sep 22, 2024
e8a9414
debug
blink1073 Sep 22, 2024
a81dc6c
debug
blink1073 Sep 22, 2024
5726882
try again
blink1073 Sep 23, 2024
367c346
clean up run task
blink1073 Sep 23, 2024
fc4a9ee
debug aws ecs
blink1073 Sep 23, 2024
f56597a
try a simplified approach
blink1073 Sep 23, 2024
e6db038
try again
blink1073 Sep 23, 2024
46aef88
try again
blink1073 Sep 23, 2024
a63395b
try again
blink1073 Sep 23, 2024
5962c68
try again
blink1073 Sep 23, 2024
4f5c888
try again
blink1073 Sep 23, 2024
4fcd7db
refactor
blink1073 Sep 23, 2024
20d8fad
fix subprocess
blink1073 Sep 23, 2024
6b47162
fixup
blink1073 Sep 23, 2024
0e99479
fixup
blink1073 Sep 23, 2024
8e07c7b
fixup
blink1073 Sep 23, 2024
649f8a8
more debug
blink1073 Sep 23, 2024
b14356c
more debug
blink1073 Sep 23, 2024
74075aa
fixup
blink1073 Sep 23, 2024
edf547c
fixup
blink1073 Sep 23, 2024
ceb59e5
Merge branch 'master' of github.com:mongodb/mongo-go-driver into GODR…
blink1073 Sep 28, 2024
0c9e402
try again
blink1073 Sep 28, 2024
b95a165
Merge branch 'master' of github.com:mongodb/mongo-go-driver into GODR…
blink1073 Oct 2, 2024
995d807
lint
blink1073 Oct 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
445 changes: 120 additions & 325 deletions .evergreen/config.yml

Large diffs are not rendered by default.

27 changes: 0 additions & 27 deletions .evergreen/run-deployed-lambda-aws-tests.sh

This file was deleted.

13 changes: 13 additions & 0 deletions .evergreen/run-task.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
#
# Source the env.sh file and run the given task
set -eu

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
PROJECT_DIRECTORY=$(dirname $SCRIPT_DIR)
pushd ${PROJECT_DIRECTORY} > /dev/null

source env.sh
task "$@"

popd > /dev/null
103 changes: 0 additions & 103 deletions .evergreen/run-tests.sh

This file was deleted.

91 changes: 91 additions & 0 deletions .evergreen/setup-system.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
#!/usr/bin/env bash
#
# Set up environment and write env.sh and expansion.yml files.
set -eu

# Set up default environment variables.
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
PROJECT_DIRECTORY=$(dirname $SCRIPT_DIR)
ROOT_DIR=$(dirname $PROJECT_DIRECTORY)
DRIVERS_TOOLS=${DRIVERS_TOOLS:-${ROOT_DIR}/drivers-evergreen-tools}
MONGO_ORCHESTRATION_HOME="${DRIVERS_TOOLS}/.evergreen/orchestration"
MONGODB_BINARIES="${DRIVERS_TOOLS}/mongodb/bin"
OS="${OS:-""}"

# Set Golang environment vars. GOROOT is wherever current Go distribution is, and is set in evergreen config.
# GOPATH is always 3 directories up from pwd on EVG; GOCACHE is under .cache in the pwd.
GOROOT=${GOROOT:-$(dirname "$(dirname "$(which go)")")}
export GOPATH=${GOPATH:-$ROOT_DIR}
export GOCACHE="${GO_CACHE:-$PROJECT_DIRECTORY/.cache}"

# Handle paths on Windows.
if [ "Windows_NT" = "${OS:-}" ]; then # Magic variable in cygwin
GOPATH=$(cygpath -m $GOPATH)
GOCACHE=$(cygpath -w $GOCACHE)
DRIVERS_TOOLS=$(cygpath -m $DRIVERS_TOOLS)
PROJECT_DIRECTORY=$(cygpath -m $PROJECT_DIRECTORY)
EXTRA_PATH=/cygdrive/c/libmongocrypt/bin
MONGO_ORCHESTRATION_HOME=$(cygpath -m $MONGO_ORCHESTRATION_HOME)
MONGODB_BINARIES=$(cygpath -m $MONGODB_BINARIES)
# Set home variables for Windows, too.
USERPROFILE=$(cygpath -w "$ROOT_DIR")
HOME=$USERPROFILE
else
EXTRA_PATH=${GCC:-}
fi

# Add binaries to the path.
PATH="${GOROOT}/bin:${GOPATH}/bin:${MONGODB_BINARIES}:${EXTRA_PATH}:${PATH}"

# Get the current unique version of this checkout.
if [ "${IS_PATCH:-}" = "true" ]; then
CURRENT_VERSION=$(git describe)-patch-${VERSION_ID}
else
CURRENT_VERSION=latest
fi

# Ensure a checkout of drivers-tools.
if [ ! -d "$DRIVERS_TOOLS" ]; then
git clone https://github.com/mongodb-labs/drivers-evergreen-tools $DRIVERS_TOOLS
fi

# Write the .env file for drivers-tools.
cat <<EOT > ${DRIVERS_TOOLS}/.env
SKIP_LEGACY_SHELL=1
DRIVERS_TOOLS="$DRIVERS_TOOLS"
MONGO_ORCHESTRATION_HOME="$MONGO_ORCHESTRATION_HOME"
MONGODB_BINARIES="$MONGODB_BINARIES"
TMPDIR="$MONGO_ORCHESTRATION_HOME/db"
EOT

# Check Go installation.
go version
go env

# Install taskfile.
go install github.com/go-task/task/v3/cmd/[email protected]

# Write our own env file.
cat <<EOT > env.sh
export GOROOT="$GOROOT"
export GOPATH="$GOPATH"
export GOCACHE="$GOCACHE"
export DRIVERS_TOOLS="$DRIVERS_TOOLS"
export PROJECT_DIRECTORY="$PROJECT_DIRECTORY"
export PATH="$PATH"
EOT

if [ "Windows_NT" = "$OS" ]; then
echo "export USERPROFILE=$USERPROFILE" >> env.sh
echo "export HOME=$HOME" >> env.sh
fi

# source the env.sh file and write the expansion file.
cat <<EOT > expansion.yml
CURRENT_VERSION: "$CURRENT_VERSION"
DRIVERS_TOOLS: "$DRIVERS_TOOLS"
PROJECT_DIRECTORY: "$PROJECT_DIRECTORY"
RUN_TASK: "$PROJECT_DIRECTORY/.evergreen/run-task.sh"
EOT

cat env.sh
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ libmongocrypt
venv
test.suite
go.work.sum
.task
env.sh
expansion.yml

# AWS SAM-generated files
internal/cmd/faas/awslambda/.aws-sam
Expand All @@ -36,3 +39,4 @@ api-report.txt
# Ignore secrets files
secrets-expansion.yml
secrets-export.sh
.test.env
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ repos:
hooks:
- id: shellcheck
name: shellcheck
args: ["--severity=error"]
args: ["--severity=warning"]

- repo: https://github.com/codespell-project/codespell
rev: "v2.2.6"
Expand Down
27 changes: 22 additions & 5 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ env:
TEST_TIMEOUT: 1800
LONG_TEST_TIMEOUT: 3600

dotenv: ['.test.env']

tasks:

### Utility tasks. ###
Expand All @@ -16,7 +18,7 @@ tasks:
check-license: bash etc/check_license.sh

build:
deps: [cross-compile, build-tests, build-compile-check]
deps: [cross-compile, build-tests, build-compile-check, install-libmongocrypt]
cmds:
- go build ./...
- go build ${BUILD_TAGS} ./...
Expand All @@ -25,6 +27,8 @@ tasks:

build-compile-check: bash etc/compile_check.sh

build-aws-ecs-test: go build ${BUILD_TAGS} ./internal/cmd/testaws/main.go

cross-compile:
- GOOS=linux GOARCH=386 go build ./...
- GOOS=linux GOARCH=arm go build ./...
Expand All @@ -46,10 +50,15 @@ tasks:

api-report: bash etc/api_report.sh

install-libmongocrypt: bash etc/install-libmongocrypt.sh
install-libmongocrypt:
cmds: [bash etc/install-libmongocrypt.sh]
status:
- test -d install || test -d /cygdrive/c/libmongocrypt/bin

run-docker: bash etc/run_docker.sh

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

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

# Lint with various GOOS and GOARCH tasks to catch static analysis failures that may only affect
Expand Down Expand Up @@ -80,7 +89,8 @@ tasks:

test-oidc: bash etc/run-oidc-test.sh 'task --silent evg-test-oidc-auth'

test-atlas: bash etc/run-atlas-test.sh
test-atlas-connect:
- go test -v -run ^TestAtlas$ go.mongodb.org/mongo-driver/v2/internal/cmd/testatlas -args "$ATLAS_REPL" "$ATLAS_SHRD" "$ATLAS_FREE" "$ATLAS_TLS11" "$ATLAS_TLS12" "$ATLAS_SERVERLESS" "$ATLAS_SRV_REPL" "$ATLAS_SRV_SHRD" "$ATLAS_SRV_FREE" "$ATLAS_SRV_TLS11" "$ATLAS_SRV_TLS12" "$ATLAS_SRV_SERVERLESS" >> test.suite

test-awskms: bash etc/run-awskms-test.sh

Expand All @@ -92,7 +102,7 @@ tasks:
- make -c internal/cmd/faas/awslambda

### Evergreen specific tasks. ###
build-aws-ecs-test: go build ${BUILD_TAGS} ./internal/cmd/testaws/main.go
setup-test: bash etc/setup-test.sh {{.CLI_ARGS}}

evg-test:
- go test -exec "env PKG_CONFIG_PATH=${PKG_CONFIG_PATH} LD_LIBRARY_PATH=${LD_LIBRARY_PATH} DYLD_LIBRARY_PATH=$MACOS_LIBRARY_PATH}" ${BUILD_TAGS} -v -timeout {{.TEST_TIMEOUT}}s -p 1 ./... >> test.suite
Expand All @@ -101,7 +111,8 @@ tasks:
- ATLAS_DATA_LAKE_INTEGRATION_TEST=true go test -v ./internal/integration -run TestUnifiedSpecs/atlas-data-lake-testing >> spec_test.suite
- ATLAS_DATA_LAKE_INTEGRATION_TEST=true go test -v ./internal/integration -run TestAtlasDataLake >> spec_test.suite

evg-test-enterprise-auth: go run -tags gssapi ./internal/cmd/testentauth/main.go
evg-test-enterprise-auth:
- go run -tags gssapi ./internal/cmd/testentauth/main.go

evg-test-oidc-auth:
- go run ./internal/cmd/testoidcauth/main.go
Expand Down Expand Up @@ -164,6 +175,12 @@ tasks:
- go test -exec "env PKG_CONFIG_PATH=${PKG_CONFIG_PATH} LD_LIBRARY_PATH=${LD_LIBRARY_PATH} DYLD_LIBRARY_PATH=${MACOS_LIBRARY_PATH}" ${BUILD_TAGS} -v -timeout {{.TEST_TIMEOUT}}s ./internal/integration >> test.suite
- go test -exec "env PKG_CONFIG_PATH=${PKG_CONFIG_PATH} LD_LIBRARY_PATH=${LD_LIBRARY_PATH} DYLD_LIBRARY_PATH=${MACOS_LIBRARY_PATH}" ${BUILD_TAGS} -v -timeout {{.TEST_TIMEOUT}}s ./internal/integration/unified >> test.suite

evg-test-aws: bash etc/run-mongodb-aws-test.sh {{.CLI_ARGS}}

evg-test-aws-ecs: bash etc/run-mongodb-aws-ecs-test.sh

evg-test-deployed-lambda-aws: bash ${DRIVERS_TOOLS}/.evergreen/aws_lambda/run-deployed-lambda-aws-tests.sh

build-kms-test: go build ${BUILD_TAGS} ./internal/cmd/testkms

### Benchmark specific tasks and support. ###
Expand Down
4 changes: 3 additions & 1 deletion docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,9 @@ However, some of the tests require secrets handling. Please see the team [Wiki]
The test suite can be run with or without the secrets as follows:

```bash
TASKFILE_TARGET=evg-test-versioned-api bash .evergreen/run-tests.sh
task setup-env
task setup-test
task evg-test-versioned-api
```

### Load Balancer
Expand Down
9 changes: 7 additions & 2 deletions etc/check_license.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ add_copyright() {
file=$1

# Check if first 24 bytes match first 24 bytes of copyright notice.
local line=$(head -c 24 $file)
local line
line=$(head -c 24 $file)
if [ "$line" == "// Copyright (C) MongoDB" ]; then
if [ ! -z "$verbose" ]; then
echo "$file already has copyright notice" >&2
Expand All @@ -21,7 +22,7 @@ add_copyright() {
fi

# Check if first 14 bytes matches the prefix "// Copied from"
local line=$(head -c 14 $file)
line=$(head -c 14 $file)
if [ "$line" == "// Copied from" ]; then
if [ ! -z "$verbose" ]; then
echo "$file has a third-party copyright notice" >&2
Expand All @@ -46,6 +47,10 @@ do
case "${flag}" in
a) add=1;;
v) verbose=1;;
*)
echo "flag not recognized"
exit 1
;;
esac
done

Expand Down
2 changes: 1 addition & 1 deletion etc/check_modules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ set -eu
mods=$(find . -name go.mod)
exit_code=0
for mod in $mods; do
pushd $(dirname $mod) > /dev/null
pushd "$(dirname $mod)" > /dev/null
echo "Checking $mod..."
go mod tidy -v
git diff --exit-code go.mod go.sum || {
Expand Down
Loading
Loading