From 9418c870da1654af018f88c3a61baa0a6ad43dfc Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Wed, 11 Oct 2023 17:22:40 -0500 Subject: [PATCH 01/30] wip --- .evergreen/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 27c450279c..4d40b2b4f9 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -163,7 +163,7 @@ functions: # 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 + git clone --branch GODRIVER-3008 https://github.com/blink1073/drivers-evergreen-tools.git $DRIVERS_TOOLS fi echo "{ \"releases\": { \"default\": \"$MONGODB_BINARIES\" }}" > $MONGO_ORCHESTRATION_HOME/orchestration.config - command: shell.exec From 8c3d7be3b0728ff804c87ecbc3cb7e19a2dc1a09 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Wed, 11 Oct 2023 17:31:59 -0500 Subject: [PATCH 02/30] GODRIVER-3008 Use mongodb-drivers-comment-bot for API reports --- .evergreen/config.yml | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 4d40b2b4f9..2bc0f5a2dc 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -348,6 +348,20 @@ functions: ${PREPARE_SHELL} sh ${PROJECT_DIRECTORY}/.evergreen/run-tests.sh + create-api-report: + - command: shell.exec + type: test + params: + shell: "bash" + working_dir: src/go.mongodb.org/mongo-driver + script: | + ${PREPARE_SHELL} + set -x + export GITHUB_BASE_REF=${branch_name} + make api-report + target=$DRIVERS_TOOLS/.evergreen/github_app/create_or_modify_comment.sh + bash $target -s "$(pwd)" -m "## API Change Report" -c "$(pwd)/api-report.md" + send-perf-data: - command: perf.send params: @@ -1199,9 +1213,10 @@ tasks: - name: static-analysis tags: ["static-analysis"] commands: - - func: run-make - vars: - targets: "check-fmt check-license check-modules lint" + - func: "create-api-report" + # - func: run-make + # vars: + # targets: "check-fmt check-license check-modules lint" - name: perf tags: ["performance"] From 229bd35ff89d3d457c34b6c8cadfd11378b7492d Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Wed, 11 Oct 2023 17:48:02 -0500 Subject: [PATCH 03/30] debug --- .evergreen/config.yml | 2 +- etc/api_report.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 2bc0f5a2dc..b2790283ad 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -1197,7 +1197,7 @@ pre: - func: windows-fix - func: fix-absolute-paths - func: make-files-executable - - func: start-cse-servers + # - func: start-cse-servers post: - command: gotest.parse_files diff --git a/etc/api_report.sh b/etc/api_report.sh index ffdac7f975..c40540ebf2 100755 --- a/etc/api_report.sh +++ b/etc/api_report.sh @@ -15,6 +15,6 @@ sha=$(git merge-base $branch HEAD) gorelease -base=$sha > api-report.txt || true -go run ./cmd/parse-api-report/main.go +go run ./cmd/parse-api-report/main.go || (cat api-report.txt && exit 1) -rm api-report.txt \ No newline at end of file +rm api-report.txt From 7b1d578ab4f5e0181fdeae47650a453ba4935aa8 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Wed, 11 Oct 2023 19:08:14 -0500 Subject: [PATCH 04/30] faster --- .evergreen/config.yml | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/.evergreen/config.yml b/.evergreen/config.yml index b2790283ad..da6e7a7d77 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -176,22 +176,22 @@ functions: # initialize submodules git submodule init git submodule update - - command: shell.exec - params: - shell: "bash" - working_dir: src/go.mongodb.org/mongo-driver - script: | - . ${DRIVERS_TOOLS}/.evergreen/venv-utils.sh - . ${DRIVERS_TOOLS}/.evergreen/find-python3.sh - - export PYTHON3_BINARY="$(find_python3)" - venvcreate "$PYTHON3_BINARY" venv - - echo "PYTHON3_BINARY: $PYTHON3_BINARY" >>expansion.yml - # Load the expansion file to make an evergreen variable with the current unique version - - command: expansions.update - params: - file: src/go.mongodb.org/mongo-driver/expansion.yml + # - command: shell.exec + # params: + # shell: "bash" + # working_dir: src/go.mongodb.org/mongo-driver + # script: | + # . ${DRIVERS_TOOLS}/.evergreen/venv-utils.sh + # . ${DRIVERS_TOOLS}/.evergreen/find-python3.sh + + # export PYTHON3_BINARY="$(find_python3)" + # venvcreate "$PYTHON3_BINARY" venv + + # echo "PYTHON3_BINARY: $PYTHON3_BINARY" >>expansion.yml + # # Load the expansion file to make an evergreen variable with the current unique version + # - command: expansions.update + # params: + # file: src/go.mongodb.org/mongo-driver/expansion.yml upload-mo-artifacts: - command: shell.exec From e8d3f75103828359cee27a43f0c816ee9088287b Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Wed, 11 Oct 2023 19:22:03 -0500 Subject: [PATCH 05/30] fix sha handling --- .evergreen/config.yml | 1 + etc/api_report.sh | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.evergreen/config.yml b/.evergreen/config.yml index da6e7a7d77..db991cb38a 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -358,6 +358,7 @@ functions: ${PREPARE_SHELL} set -x export GITHUB_BASE_REF=${branch_name} + export GITHUB_BASE_SHA=${github_commit} make api-report target=$DRIVERS_TOOLS/.evergreen/github_app/create_or_modify_comment.sh bash $target -s "$(pwd)" -m "## API Change Report" -c "$(pwd)/api-report.md" diff --git a/etc/api_report.sh b/etc/api_report.sh index c40540ebf2..49797d57fc 100755 --- a/etc/api_report.sh +++ b/etc/api_report.sh @@ -11,7 +11,11 @@ fi branch=${GITHUB_BASE_REF:-master} git fetch origin $branch:$branch -sha=$(git merge-base $branch HEAD) +if [ -z "${GITHUB_BASE_SHA:-}"]; then + sha=$(git merge-base $branch HEAD) +else + sha="$GITHUB_BASE_SHA" +fi gorelease -base=$sha > api-report.txt || true From 6955a06c793e96551faeda2815e18a568769cbaf Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Wed, 11 Oct 2023 19:27:57 -0500 Subject: [PATCH 06/30] fix sha handling --- etc/api_report.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/api_report.sh b/etc/api_report.sh index 49797d57fc..3d8ccaf92c 100755 --- a/etc/api_report.sh +++ b/etc/api_report.sh @@ -10,8 +10,8 @@ if [ -z $cmd ]; then fi branch=${GITHUB_BASE_REF:-master} -git fetch origin $branch:$branch if [ -z "${GITHUB_BASE_SHA:-}"]; then + git fetch origin $branch:$branch sha=$(git merge-base $branch HEAD) else sha="$GITHUB_BASE_SHA" From 4d4569d179cd55ad4e2218f9bd839a77563a5e1e Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Wed, 11 Oct 2023 19:43:05 -0500 Subject: [PATCH 07/30] try again --- .evergreen/config.yml | 1 + etc/api_report.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.evergreen/config.yml b/.evergreen/config.yml index db991cb38a..ef3518e274 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -359,6 +359,7 @@ functions: set -x export GITHUB_BASE_REF=${branch_name} export GITHUB_BASE_SHA=${github_commit} + git checkout -b test-api-report make api-report target=$DRIVERS_TOOLS/.evergreen/github_app/create_or_modify_comment.sh bash $target -s "$(pwd)" -m "## API Change Report" -c "$(pwd)/api-report.md" diff --git a/etc/api_report.sh b/etc/api_report.sh index 3d8ccaf92c..a04a6bb39b 100755 --- a/etc/api_report.sh +++ b/etc/api_report.sh @@ -10,7 +10,7 @@ if [ -z $cmd ]; then fi branch=${GITHUB_BASE_REF:-master} -if [ -z "${GITHUB_BASE_SHA:-}"]; then +if [ -z "${GITHUB_BASE_SHA:-}" ]; then git fetch origin $branch:$branch sha=$(git merge-base $branch HEAD) else From 80775875001e96a5bdf7420237d7b9f370c035b4 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Wed, 11 Oct 2023 19:53:24 -0500 Subject: [PATCH 08/30] more debug --- .evergreen/config.yml | 1 + etc/api_report.sh | 1 + 2 files changed, 2 insertions(+) diff --git a/.evergreen/config.yml b/.evergreen/config.yml index ef3518e274..eb1cdb2285 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -360,6 +360,7 @@ functions: export GITHUB_BASE_REF=${branch_name} export GITHUB_BASE_SHA=${github_commit} git checkout -b test-api-report + git status make api-report target=$DRIVERS_TOOLS/.evergreen/github_app/create_or_modify_comment.sh bash $target -s "$(pwd)" -m "## API Change Report" -c "$(pwd)/api-report.md" diff --git a/etc/api_report.sh b/etc/api_report.sh index a04a6bb39b..ca366fd390 100755 --- a/etc/api_report.sh +++ b/etc/api_report.sh @@ -17,6 +17,7 @@ else sha="$GITHUB_BASE_SHA" fi +git status gorelease -base=$sha > api-report.txt || true go run ./cmd/parse-api-report/main.go || (cat api-report.txt && exit 1) From 208bd8037e511dd18cb1948adbd38f80af899e1a Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Wed, 11 Oct 2023 20:04:59 -0500 Subject: [PATCH 09/30] cleanup --- .evergreen/config.yml | 3 ++- .gitignore | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.evergreen/config.yml b/.evergreen/config.yml index eb1cdb2285..5e26b0b7e0 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -360,7 +360,8 @@ functions: export GITHUB_BASE_REF=${branch_name} export GITHUB_BASE_SHA=${github_commit} git checkout -b test-api-report - git status + git add . + git commit -m "local changes" make api-report target=$DRIVERS_TOOLS/.evergreen/github_app/create_or_modify_comment.sh bash $target -s "$(pwd)" -m "## API Change Report" -c "$(pwd)/api-report.md" diff --git a/.gitignore b/.gitignore index 16b52325e4..ad147c4280 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,9 @@ perf *.test .DS_Store main.so +.cache +install +libmongocrypt # AWS SAM-generated files internal/test/faas/awslambda/.aws-sam From ce77ded7df38e0dfcac1c82d16544a37c7d6a895 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Wed, 11 Oct 2023 20:25:56 -0500 Subject: [PATCH 10/30] better debug --- etc/api_report.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/etc/api_report.sh b/etc/api_report.sh index ca366fd390..02d1c16f17 100755 --- a/etc/api_report.sh +++ b/etc/api_report.sh @@ -20,6 +20,8 @@ fi git status gorelease -base=$sha > api-report.txt || true -go run ./cmd/parse-api-report/main.go || (cat api-report.txt && exit 1) +cat api-report.txt + +go run ./cmd/parse-api-report/main.go rm api-report.txt From 20a6aac39796b1edccd5e4cbe2c87b4feef9db3e Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Thu, 12 Oct 2023 05:20:36 -0500 Subject: [PATCH 11/30] move drivers-tools up --- .evergreen/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 5e26b0b7e0..3a6205bd09 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -54,7 +54,7 @@ functions: export GOCACHE="$(pwd)/.cache" # Set other relevant variables for Evergreen processes. - export DRIVERS_TOOLS="$(pwd)/../drivers-tools" + export DRIVERS_TOOLS="$(pwd)/../../drivers-tools" export PROJECT_DIRECTORY="$(pwd)" export MONGO_ORCHESTRATION_HOME="$DRIVERS_TOOLS/.evergreen/orchestration" export MONGODB_BINARIES="$DRIVERS_TOOLS/mongodb/bin" From 9205df97aa8bd0ec52d35200cd279e5630a3e9d6 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Thu, 12 Oct 2023 05:34:59 -0500 Subject: [PATCH 12/30] clean up drivers tools location --- .evergreen/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 3a6205bd09..5ce1d69814 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -54,7 +54,7 @@ functions: export GOCACHE="$(pwd)/.cache" # Set other relevant variables for Evergreen processes. - export DRIVERS_TOOLS="$(pwd)/../../drivers-tools" + export DRIVERS_TOOLS="$(dirname $(dirname `pwd`))/drivers-tools" export PROJECT_DIRECTORY="$(pwd)" export MONGO_ORCHESTRATION_HOME="$DRIVERS_TOOLS/.evergreen/orchestration" export MONGODB_BINARIES="$DRIVERS_TOOLS/mongodb/bin" From dcc02862c7988d6d97e209424ea1adaf7fdaa966 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Thu, 12 Oct 2023 05:37:47 -0500 Subject: [PATCH 13/30] go up one more level for drivers-tools --- .evergreen/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 5ce1d69814..34dc860c16 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -54,7 +54,7 @@ functions: export GOCACHE="$(pwd)/.cache" # Set other relevant variables for Evergreen processes. - export DRIVERS_TOOLS="$(dirname $(dirname `pwd`))/drivers-tools" + export DRIVERS_TOOLS="$(dirname $(dirname $(dirname `pwd`)))/drivers-tools" export PROJECT_DIRECTORY="$(pwd)" export MONGO_ORCHESTRATION_HOME="$DRIVERS_TOOLS/.evergreen/orchestration" export MONGODB_BINARIES="$DRIVERS_TOOLS/mongodb/bin" From 3be69c1bc55164c3ca55bd73f9649f086d319d47 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Thu, 12 Oct 2023 08:47:36 -0500 Subject: [PATCH 14/30] try on ubuntu 22 --- .evergreen/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 34dc860c16..877451517f 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -2694,7 +2694,7 @@ buildvariants: tags: ["pullrequest"] display_name: "Static Analysis" run_on: - - rhel8.7-large + - ubuntu2204-large expansions: GO_DIST: "/opt/golang/go1.20" tasks: From c8778af67b9d79c44eff237f7c8c16b05e62737e Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Thu, 12 Oct 2023 09:34:37 -0500 Subject: [PATCH 15/30] switch back to rhel --- .evergreen/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 877451517f..34dc860c16 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -2694,7 +2694,7 @@ buildvariants: tags: ["pullrequest"] display_name: "Static Analysis" run_on: - - ubuntu2204-large + - rhel8.7-large expansions: GO_DIST: "/opt/golang/go1.20" tasks: From ea5bb9afea52e1f83f27dfea9849cf7b115b88e7 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Thu, 12 Oct 2023 12:13:29 -0500 Subject: [PATCH 16/30] hard-code base commit for now --- .evergreen/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 34dc860c16..964520e985 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -358,7 +358,7 @@ functions: ${PREPARE_SHELL} set -x export GITHUB_BASE_REF=${branch_name} - export GITHUB_BASE_SHA=${github_commit} + export GITHUB_BASE_SHA=757e2a7896f9090276cfc358ce7ce3463f0f4fd0 git checkout -b test-api-report git add . git commit -m "local changes" From 9931613030cc863406e2daacb4f2fedc0ac8b3c7 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Thu, 12 Oct 2023 12:18:10 -0500 Subject: [PATCH 17/30] try going back to detached state --- .evergreen/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 964520e985..feedeaf02a 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -363,6 +363,7 @@ functions: git add . git commit -m "local changes" make api-report + git checkout ${github_commit} target=$DRIVERS_TOOLS/.evergreen/github_app/create_or_modify_comment.sh bash $target -s "$(pwd)" -m "## API Change Report" -c "$(pwd)/api-report.md" From 26495538f70b860bf687f1c0e5fd6dc88f813355 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Thu, 12 Oct 2023 12:32:59 -0500 Subject: [PATCH 18/30] debug --- .evergreen/config.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.evergreen/config.yml b/.evergreen/config.yml index feedeaf02a..cd47da80c6 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -359,6 +359,8 @@ functions: set -x export GITHUB_BASE_REF=${branch_name} export GITHUB_BASE_SHA=757e2a7896f9090276cfc358ce7ce3463f0f4fd0 + env + exit 1 git checkout -b test-api-report git add . git commit -m "local changes" From c43c9a7bb4f21fd088e87cfec0c75edc4138ec21 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Thu, 12 Oct 2023 12:33:19 -0500 Subject: [PATCH 19/30] debug --- .evergreen/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.evergreen/config.yml b/.evergreen/config.yml index cd47da80c6..f674fe4d0d 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -354,6 +354,7 @@ functions: params: shell: "bash" working_dir: src/go.mongodb.org/mongo-driver + add_expansions_to_env: true script: | ${PREPARE_SHELL} set -x From b16bf90cc88645a2601a832ea822ef287b448ba7 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Thu, 12 Oct 2023 12:54:41 -0500 Subject: [PATCH 20/30] check the revision --- .evergreen/config.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.evergreen/config.yml b/.evergreen/config.yml index f674fe4d0d..79a3448c89 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -360,8 +360,7 @@ functions: set -x export GITHUB_BASE_REF=${branch_name} export GITHUB_BASE_SHA=757e2a7896f9090276cfc358ce7ce3463f0f4fd0 - env - exit 1 + echo "REVISION: ${revision}" git checkout -b test-api-report git add . git commit -m "local changes" From af564711d047af921332a14905e4012ccf434965 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Thu, 12 Oct 2023 12:59:53 -0500 Subject: [PATCH 21/30] final version --- .evergreen/config.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 79a3448c89..95ac51bfb7 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -359,8 +359,7 @@ functions: ${PREPARE_SHELL} set -x export GITHUB_BASE_REF=${branch_name} - export GITHUB_BASE_SHA=757e2a7896f9090276cfc358ce7ce3463f0f4fd0 - echo "REVISION: ${revision}" + export GITHUB_BASE_SHA=${revision} git checkout -b test-api-report git add . git commit -m "local changes" From 9a8803d1ca84c06200e563789f33342d6710100e Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Thu, 12 Oct 2023 18:33:18 -0500 Subject: [PATCH 22/30] Refactor --- .evergreen/config.yml | 14 +++----------- Makefile | 4 ---- etc/api_report.sh | 32 ++++++++++++++++++-------------- 3 files changed, 21 insertions(+), 29 deletions(-) diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 95ac51bfb7..99b526356c 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -354,19 +354,11 @@ functions: params: shell: "bash" working_dir: src/go.mongodb.org/mongo-driver - add_expansions_to_env: true script: | ${PREPARE_SHELL} - set -x - export GITHUB_BASE_REF=${branch_name} - export GITHUB_BASE_SHA=${revision} - git checkout -b test-api-report - git add . - git commit -m "local changes" - make api-report - git checkout ${github_commit} - target=$DRIVERS_TOOLS/.evergreen/github_app/create_or_modify_comment.sh - bash $target -s "$(pwd)" -m "## API Change Report" -c "$(pwd)/api-report.md" + export BASE_SHA=${revision} + export HEAD_SHA=${github_commit} + bash etc/api-report.sh send-perf-data: - command: perf.send diff --git a/Makefile b/Makefile index d08f6eba3e..e0eb9c9fad 100644 --- a/Makefile +++ b/Makefile @@ -24,10 +24,6 @@ build: cross-compile build-tests build-compile-check build-tests: go test -short $(BUILD_TAGS) -run ^$$ ./... -.PHONY: api-report -api-report: - etc/api_report.sh - .PHONY: build-compile-check build-compile-check: etc/compile_check.sh diff --git a/etc/api_report.sh b/etc/api_report.sh index 02d1c16f17..f423e040ba 100755 --- a/etc/api_report.sh +++ b/etc/api_report.sh @@ -3,25 +3,29 @@ # Generates a report of Go Driver API changes for the current branch. set -eux -cmd=$(command -v gorelease || true) +if [ "$BASE_SHA" == "$HEAD_SHA" ]; then + echo "Skipping API Report" + exit 0 +fi + +# Ensure a clean checkout. +git checkout -b test-api-report +git add . +git commit -m "local changes" +# Ensure gorelease is installed. +cmd=$(command -v gorelease || true) if [ -z $cmd ]; then go install golang.org/x/exp/cmd/gorelease@latest fi -branch=${GITHUB_BASE_REF:-master} -if [ -z "${GITHUB_BASE_SHA:-}" ]; then - git fetch origin $branch:$branch - sha=$(git merge-base $branch HEAD) -else - sha="$GITHUB_BASE_SHA" -fi - -git status -gorelease -base=$sha > api-report.txt || true - +# Generate and parse the report. +gorelease -base=$BASE_SHA > api-report.txt || true cat api-report.txt - go run ./cmd/parse-api-report/main.go - rm api-report.txt +cat "test!" >> api-report.md + +# Make the PR comment. +target=$DRIVERS_TOOLS/.evergreen/github_app/create_or_modify_comment.sh +bash $target -s "$(pwd)" -m "## API Change Report" -c "$(pwd)/api-report.md" -h $HEAD_SHA From 01320bdaa5124784a4617c3a55beead1fd648cda Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Thu, 12 Oct 2023 18:38:09 -0500 Subject: [PATCH 23/30] fix name --- .evergreen/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 99b526356c..8b602c4005 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -358,7 +358,7 @@ functions: ${PREPARE_SHELL} export BASE_SHA=${revision} export HEAD_SHA=${github_commit} - bash etc/api-report.sh + bash etc/api_report.sh send-perf-data: - command: perf.send From cf41b372cdd4ca860e45cd7687499a9ce57a931c Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Thu, 12 Oct 2023 19:58:59 -0500 Subject: [PATCH 24/30] fixup --- etc/api_report.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/api_report.sh b/etc/api_report.sh index f423e040ba..35b7e51b4c 100755 --- a/etc/api_report.sh +++ b/etc/api_report.sh @@ -24,7 +24,7 @@ gorelease -base=$BASE_SHA > api-report.txt || true cat api-report.txt go run ./cmd/parse-api-report/main.go rm api-report.txt -cat "test!" >> api-report.md +echo "test!" >> api-report.md # Make the PR comment. target=$DRIVERS_TOOLS/.evergreen/github_app/create_or_modify_comment.sh From c1d1d643f2eb74194a17dd4e3ec08a9bd4967193 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Thu, 12 Oct 2023 20:06:47 -0500 Subject: [PATCH 25/30] cleanup --- .evergreen/config.yml | 6 +++--- .evergreen/run-tests.sh | 2 +- etc/api_report.sh | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 8b602c4005..93739b4c6b 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -1212,9 +1212,9 @@ tasks: tags: ["static-analysis"] commands: - func: "create-api-report" - # - func: run-make - # vars: - # targets: "check-fmt check-license check-modules lint" + - func: run-make + vars: + targets: "check-fmt check-license check-modules lint" - name: perf tags: ["performance"] diff --git a/.evergreen/run-tests.sh b/.evergreen/run-tests.sh index a223f309f8..95073b0b26 100644 --- a/.evergreen/run-tests.sh +++ b/.evergreen/run-tests.sh @@ -4,7 +4,7 @@ set -o errexit export GOPATH=$(dirname $(dirname $(dirname `pwd`))) export GOCACHE="$(pwd)/.cache" -export DRIVERS_TOOLS="$(pwd)/../drivers-tools" +export DRIVERS_TOOLS="$(dirname $(dirname $(dirname `pwd`)))/drivers-tools" if [ "Windows_NT" = "$OS" ]; then export GOPATH=$(cygpath -m $GOPATH) diff --git a/etc/api_report.sh b/etc/api_report.sh index 35b7e51b4c..895622e1f5 100755 --- a/etc/api_report.sh +++ b/etc/api_report.sh @@ -3,6 +3,7 @@ # Generates a report of Go Driver API changes for the current branch. set -eux +# Skip the report of it isn't a PR run. if [ "$BASE_SHA" == "$HEAD_SHA" ]; then echo "Skipping API Report" exit 0 @@ -24,7 +25,6 @@ gorelease -base=$BASE_SHA > api-report.txt || true cat api-report.txt go run ./cmd/parse-api-report/main.go rm api-report.txt -echo "test!" >> api-report.md # Make the PR comment. target=$DRIVERS_TOOLS/.evergreen/github_app/create_or_modify_comment.sh From 8d4b9fd98fc66dfc1d9e674d1a37ebd1a9d4843e Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Thu, 12 Oct 2023 20:11:52 -0500 Subject: [PATCH 26/30] update to pass in repo name and owner --- etc/api_report.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/api_report.sh b/etc/api_report.sh index 895622e1f5..9d045661b2 100755 --- a/etc/api_report.sh +++ b/etc/api_report.sh @@ -28,4 +28,4 @@ rm api-report.txt # Make the PR comment. target=$DRIVERS_TOOLS/.evergreen/github_app/create_or_modify_comment.sh -bash $target -s "$(pwd)" -m "## API Change Report" -c "$(pwd)/api-report.md" -h $HEAD_SHA +bash $target -s "$(pwd)" -m "## API Change Report" -c "$(pwd)/api-report.md" -h $HEAD_SHA -o "mongodb" -n "mongo-go-driver" From 819a98d8a61d6adb23fd015ff35feb9221eaa410 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Thu, 12 Oct 2023 20:12:12 -0500 Subject: [PATCH 27/30] remove unused arg --- etc/api_report.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/api_report.sh b/etc/api_report.sh index 9d045661b2..5478241dca 100755 --- a/etc/api_report.sh +++ b/etc/api_report.sh @@ -28,4 +28,4 @@ rm api-report.txt # Make the PR comment. target=$DRIVERS_TOOLS/.evergreen/github_app/create_or_modify_comment.sh -bash $target -s "$(pwd)" -m "## API Change Report" -c "$(pwd)/api-report.md" -h $HEAD_SHA -o "mongodb" -n "mongo-go-driver" +bash $target -m "## API Change Report" -c "$(pwd)/api-report.md" -h $HEAD_SHA -o "mongodb" -n "mongo-go-driver" From 078e45ccde471948b9c0bc2a27e50998f4222a32 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Fri, 13 Oct 2023 06:23:03 -0500 Subject: [PATCH 28/30] more cleanup --- .evergreen/config.yml | 36 +++++++++++++++--------------- .github/workflows/comment.yml | 42 ----------------------------------- 2 files changed, 18 insertions(+), 60 deletions(-) delete mode 100644 .github/workflows/comment.yml diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 93739b4c6b..00760782ca 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -176,22 +176,22 @@ functions: # initialize submodules git submodule init git submodule update - # - command: shell.exec - # params: - # shell: "bash" - # working_dir: src/go.mongodb.org/mongo-driver - # script: | - # . ${DRIVERS_TOOLS}/.evergreen/venv-utils.sh - # . ${DRIVERS_TOOLS}/.evergreen/find-python3.sh - - # export PYTHON3_BINARY="$(find_python3)" - # venvcreate "$PYTHON3_BINARY" venv - - # echo "PYTHON3_BINARY: $PYTHON3_BINARY" >>expansion.yml - # # Load the expansion file to make an evergreen variable with the current unique version - # - command: expansions.update - # params: - # file: src/go.mongodb.org/mongo-driver/expansion.yml + - command: shell.exec + params: + shell: "bash" + working_dir: src/go.mongodb.org/mongo-driver + script: | + . ${DRIVERS_TOOLS}/.evergreen/venv-utils.sh + . ${DRIVERS_TOOLS}/.evergreen/find-python3.sh + + export PYTHON3_BINARY="$(find_python3)" + venvcreate "$PYTHON3_BINARY" venv + + echo "PYTHON3_BINARY: $PYTHON3_BINARY" >>expansion.yml + # Load the expansion file to make an evergreen variable with the current unique version + - command: expansions.update + params: + file: src/go.mongodb.org/mongo-driver/expansion.yml upload-mo-artifacts: - command: shell.exec @@ -1195,7 +1195,7 @@ pre: - func: windows-fix - func: fix-absolute-paths - func: make-files-executable - # - func: start-cse-servers + - func: start-cse-servers post: - command: gotest.parse_files @@ -1211,10 +1211,10 @@ tasks: - name: static-analysis tags: ["static-analysis"] commands: - - func: "create-api-report" - func: run-make vars: targets: "check-fmt check-license check-modules lint" + - func: "create-api-report" - name: perf tags: ["performance"] diff --git a/.github/workflows/comment.yml b/.github/workflows/comment.yml deleted file mode 100644 index 0b471f3fff..0000000000 --- a/.github/workflows/comment.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: PR API Report -on: - pull_request_target: - types: [review_requested] - -jobs: - comment: - runs-on: ubuntu-latest - permissions: - pull-requests: write - issues: write - environment: - api-report - steps: - - uses: actions/setup-go@v4 - - name: Find Comment - uses: peter-evans/find-comment@v2 - id: fc - with: - issue-number: ${{ github.event.pull_request.number }} - comment-author: 'github-actions[bot]' - body-includes: "## API Change Report" - - - name: Create the comment body - run: | - set -eux - git clone https://github.com/mongodb/mongo-go-driver - cd mongo-go-driver - git remote add source https://github.com/$GITHUB_REPOSITORY_OWNER/mongo-go-driver - git fetch origin $GITHUB_BASE_REF - git fetch source $GITHUB_HEAD_REF - git checkout $GITHUB_HEAD_REF - make api-report - cat api-report.md - - - name: Create or update comment - uses: peter-evans/create-or-update-comment@v3 - with: - comment-id: ${{ steps.fc.outputs.comment-id }} - issue-number: ${{ github.event.pull_request.number }} - body-path: 'mongo-go-driver/api-report.md' - edit-mode: replace From 32852df9d2ace332db02b09259db6ce809e9703e Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Fri, 13 Oct 2023 21:27:21 -0500 Subject: [PATCH 29/30] update gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index ad147c4280..095f3a76fe 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,7 @@ main.so .cache install libmongocrypt +venv # AWS SAM-generated files internal/test/faas/awslambda/.aws-sam From c5d4eaea687b437b9c50898d2eef5a7b6be64330 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Mon, 16 Oct 2023 14:41:36 -0500 Subject: [PATCH 30/30] use master branch --- .evergreen/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 00760782ca..1efce03f52 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -163,7 +163,7 @@ functions: # 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 --branch GODRIVER-3008 https://github.com/blink1073/drivers-evergreen-tools.git $DRIVERS_TOOLS + git clone https://github.com/mongodb-labs/drivers-evergreen-tools.git $DRIVERS_TOOLS fi echo "{ \"releases\": { \"default\": \"$MONGODB_BINARIES\" }}" > $MONGO_ORCHESTRATION_HOME/orchestration.config - command: shell.exec