From e0857d2aa2d76661bc17933c1f12b77920b197ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kr=C3=A6n=20Hansen?= Date: Wed, 13 Nov 2024 23:49:30 +0100 Subject: [PATCH] Use artifactory mirror as docker registry --- .evergreen/functions.yml | 12 ++++++++++++ .evergreen/start-atlas-cloud-cluster.sh | 4 +++- .evergreen/start-atlas-local.sh | 7 ++++--- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/.evergreen/functions.yml b/.evergreen/functions.yml index bb69785b943..f648914ecd4 100644 --- a/.evergreen/functions.yml +++ b/.evergreen/functions.yml @@ -600,11 +600,15 @@ functions: COMPASS_E2E_TEST_GROUPS: ${e2e_test_groups} COMPASS_E2E_TEST_GROUP: ${e2e_test_group} ATLAS_LOCAL_VERSION: latest + DOCKER_REGISTRY: artifactory.corp.mongodb.com script: | set -e # Load environment variables eval $(.evergreen/print-compass-env.sh) + # Authenticate with the Artifactory docker registry + echo "${ARTIFACTORY_PASSWORD}" | docker login "${DOCKER_REGISTRY}" --username "${ARTIFACTORY_USERNAME}" --password-stdin + # Start atlas local to test Atlas Search source .evergreen/start-atlas-local.sh @@ -690,14 +694,22 @@ functions: MCLI_ORG_ID: ${e2e_tests_mcli_org_id} MCLI_PROJECT_ID: ${e2e_tests_mcli_project_id} MCLI_OPS_MANAGER_URL: ${e2e_tests_mcli_ops_manager_url} + DOCKER_REGISTRY: artifactory.corp.mongodb.com script: | set -e + # Load environment variables eval $(.evergreen/print-compass-env.sh) + + # Authenticate with the Artifactory docker registry + echo "${ARTIFACTORY_PASSWORD}" | docker login "${DOCKER_REGISTRY}" --username "${ARTIFACTORY_USERNAME}" --password-stdin + # Create Atlas cluster for test project source .evergreen/start-atlas-cloud-cluster.sh + # Run the tests echo "Starting e2e tests..." + # We're only running a special subset of tests as provisioning atlas # clusters in CI is both pricey and flakey, so we want to limit the # coverage to reduce those factors (at least for now) diff --git a/.evergreen/start-atlas-cloud-cluster.sh b/.evergreen/start-atlas-cloud-cluster.sh index 5c38b3d1f14..c9e3898fc0f 100644 --- a/.evergreen/start-atlas-cloud-cluster.sh +++ b/.evergreen/start-atlas-cloud-cluster.sh @@ -61,6 +61,8 @@ ATLAS_CLUSTER_NAME="${_ATLAS_CLOUD_TEST_CLUSTER_NAME:-$DEFAULT_ATLAS_CLOUD_TEST_ ATLAS_TEST_DB_USERNAME="testuser-$RUN_ID" ATLAS_TEST_DB_PASSWORD="$(head -c 32 /dev/urandom | base64 | tr -dc 'a-zA-Z0-9')" +DOCKER_REGISTRY="${DOCKER_REGISTRY-registry.hub.docker.com}" + function atlascli() { docker run \ -e MCLI_PUBLIC_API_KEY \ @@ -68,7 +70,7 @@ function atlascli() { -e MCLI_ORG_ID \ -e MCLI_PROJECT_ID \ -e MCLI_OPS_MANAGER_URL \ - mongodb/atlas atlas $@ + $DOCKER_REGISTRY/library/mongodb/atlas atlas $@ } cleanup() { diff --git a/.evergreen/start-atlas-local.sh b/.evergreen/start-atlas-local.sh index 75dce43a048..cbec832e6e3 100755 --- a/.evergreen/start-atlas-local.sh +++ b/.evergreen/start-atlas-local.sh @@ -20,11 +20,12 @@ cleanup() { trap cleanup EXIT # Image name with version -IMAGE_NAME="mongodb/mongodb-atlas-local:$ATLAS_LOCAL_VERSION" -echo docker run --rm --name $CONTAINER_NAME -d -e DO_NOT_TRACK=1 -P "$IMAGE_NAME" +DOCKER_REGISTRY="${DOCKER_REGISTRY-registry.hub.docker.com}" +DOCKER_IMAGE="$DOCKER_REGISTRY/library/mongodb/mongodb-atlas-local:$ATLAS_LOCAL_VERSION" +echo docker run --rm --name $CONTAINER_NAME -d -e DO_NOT_TRACK=1 -P "$DOCKER_IMAGE" # Start the Docker container -docker run --rm --name $CONTAINER_NAME -d -e DO_NOT_TRACK=1 -P "$IMAGE_NAME" +docker run --rm --name $CONTAINER_NAME -d -e DO_NOT_TRACK=1 -P "$DOCKER_IMAGE" echo "Waiting for container to become healthy..."