From 5da8f18c36e0df55246272535a9a4dcb568723a5 Mon Sep 17 00:00:00 2001 From: Adam Rayner Date: Mon, 18 Mar 2024 18:17:01 +0000 Subject: [PATCH] SERVER-86820 Clean up Azure and Okta integration test artifacts GitOrigin-RevId: dbd2bee4c37e5ab05c9aff19b6dc8a96617c4ca5 --- etc/evergreen_yml_components/definitions.yml | 10 ++++++++++ .../clusters_and_integrations/tasks.yml | 5 ----- evergreen/external_auth_azure_teardown.sh | 19 +++++++++++++++++++ evergreen/external_auth_gcp_teardown.sh | 2 ++ evergreen/external_auth_oidc_teardown.sh | 15 +++++++++++++++ 5 files changed, 46 insertions(+), 5 deletions(-) create mode 100644 evergreen/external_auth_oidc_teardown.sh diff --git a/etc/evergreen_yml_components/definitions.yml b/etc/evergreen_yml_components/definitions.yml index a7cb98f39f6..a7fd660f6b5 100644 --- a/etc/evergreen_yml_components/definitions.yml +++ b/etc/evergreen_yml_components/definitions.yml @@ -2439,6 +2439,16 @@ functions: binary: bash args: - "./src/evergreen/external_auth_gcp_teardown.sh" + - command: subprocess.exec + params: + binary: bash + args: + - "./src/evergreen/external_auth_azure_teardown.sh" + - command: subprocess.exec + params: + binary: bash + args: + - "./src/evergreen/external_auth_oidc_teardown.sh" "do scons setup": - command: manifest.load diff --git a/etc/evergreen_yml_components/tasks/resmoke/server_divisions/clusters_and_integrations/tasks.yml b/etc/evergreen_yml_components/tasks/resmoke/server_divisions/clusters_and_integrations/tasks.yml index 0c685e80248..ded6806f6bf 100644 --- a/etc/evergreen_yml_components/tasks/resmoke/server_divisions/clusters_and_integrations/tasks.yml +++ b/etc/evergreen_yml_components/tasks/resmoke/server_divisions/clusters_and_integrations/tasks.yml @@ -797,11 +797,6 @@ tasks: args: - "src/evergreen/external_auth_azure_setup.sh" - func: "run tests" - - command: subprocess.exec - params: - binary: bash - args: - - "src/evergreen/external_auth_azure_teardown.sh" - <<: *task_template name: external_auth_oidc_gcp diff --git a/evergreen/external_auth_azure_teardown.sh b/evergreen/external_auth_azure_teardown.sh index 81d547f21ac..a62cb65a02d 100644 --- a/evergreen/external_auth_azure_teardown.sh +++ b/evergreen/external_auth_azure_teardown.sh @@ -1,6 +1,25 @@ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null 2>&1 && pwd)" . "$DIR/prelude.sh" +# Only run this script for the external_auth_oidc_azure task. +if [ "${task_name}" != "external_auth_oidc_azure" ]; then + exit 0 +fi + +echo "Cleaning up Azure OIDC test artifacts" + cd src +# Clean up the SSH keyfile, if it exists +if [ -f "${HOME}/oidc_azure_container_key" ]; then + rm -f $HOME/oidc_azure_container_key + echo "Cleaned up container key" +fi + python src/mongo/db/modules/enterprise/jstests/external_auth_oidc_azure/lib/toggle_ingress.py disable --config_file=$HOME/azure_e2e_config.json + +# Clean up the config file, if it exists +if [ -f "${HOME}/azure_e2e_config.json" ]; then + rm -f $HOME/azure_e2e_config.json + echo "Cleaned up azure_e2e_config.json" +fi diff --git a/evergreen/external_auth_gcp_teardown.sh b/evergreen/external_auth_gcp_teardown.sh index 95018846bde..f6e72fcf77f 100755 --- a/evergreen/external_auth_gcp_teardown.sh +++ b/evergreen/external_auth_gcp_teardown.sh @@ -10,6 +10,8 @@ if [ "${task_name}" != "external_auth_oidc_gcp" ]; then exit 0 fi +echo "Cleaning up OIDC GCP test artifacts" + # Delete the GCP VM specified in gce_vm_info.json if GOOGLE_APPLICATION_CREDENTIALS is set, points # to a file, and the GCE config and VM info files exist. if [ ! -z "${GOOGLE_APPLICATION_CREDENTIALS}" ] \ diff --git a/evergreen/external_auth_oidc_teardown.sh b/evergreen/external_auth_oidc_teardown.sh new file mode 100644 index 00000000000..5216e93c6c9 --- /dev/null +++ b/evergreen/external_auth_oidc_teardown.sh @@ -0,0 +1,15 @@ +DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null 2>&1 && pwd)" +. "$DIR/prelude.sh" + +# Only run this script for the external_auth_oidc_azure task. +if [ "${task_name}" != "external_auth_oidc" ]; then + exit 0 +fi + +echo "Cleaning up OIDC Okta test artifacts" + +#Clean up the config file, if it exists +if [ -f "${HOME}/oidc_e2e_setup.json" ]; then + rm -f $HOME/oidc_e2e_setup.json + echo "Cleaned up oidc_e2e_setup.json" +fi