From 86d6749615a533e0a9fbe0a1dca97b38fb14bb5f Mon Sep 17 00:00:00 2001 From: Charlie Lye Date: Mon, 4 Mar 2024 17:09:54 +0000 Subject: [PATCH] feat: Login to ecr explicitly, faster bootstrap as we only do once. (#4900) We logged into ecr before every image extraction. This actually added quite a few seconds. Login to ecr explicitly (for bootstrap this is now just once at startup). A "noop" fast bootstrap now as little as 17s. --- barretenberg/cpp/scripts/ci/upload_benchmarks_to_s3.sh | 3 ++- barretenberg/cpp/scripts/ci/upload_doxygen_to_s3.sh | 1 + build-system/scripts/deploy_npm | 1 + build-system/scripts/deploy_s3 | 1 + build-system/scripts/extract_repo | 1 - docs/deploy_netlify.sh | 3 ++- yarn-project/deploy_npm.sh | 1 + 7 files changed, 8 insertions(+), 3 deletions(-) diff --git a/barretenberg/cpp/scripts/ci/upload_benchmarks_to_s3.sh b/barretenberg/cpp/scripts/ci/upload_benchmarks_to_s3.sh index 03603d20c03..6a924ba33df 100755 --- a/barretenberg/cpp/scripts/ci/upload_benchmarks_to_s3.sh +++ b/barretenberg/cpp/scripts/ci/upload_benchmarks_to_s3.sh @@ -1,8 +1,9 @@ -# Uploads to S3 a recent barretenberg benchmark run. +# Uploads to S3 a recent barretenberg benchmark run. #!/usr/bin/env bash [ -n "${BUILD_SYSTEM_DEBUG:-}" ] && set -x # conditionally trace set -eu +retry ecr_login extract_repo barretenberg-bench /usr/src extracted-repo BUCKET_NAME="aztec-ci-artifacts" diff --git a/barretenberg/cpp/scripts/ci/upload_doxygen_to_s3.sh b/barretenberg/cpp/scripts/ci/upload_doxygen_to_s3.sh index 14560bd01a2..a726a1511c9 100755 --- a/barretenberg/cpp/scripts/ci/upload_doxygen_to_s3.sh +++ b/barretenberg/cpp/scripts/ci/upload_doxygen_to_s3.sh @@ -4,6 +4,7 @@ [ -n "${BUILD_SYSTEM_DEBUG:-}" ] && set -x # conditionally trace set -eu +retry ecr_login extract_repo barretenberg-docs /usr/src extracted-repo BUCKET_NAME="aztec-ci-artifacts" diff --git a/build-system/scripts/deploy_npm b/build-system/scripts/deploy_npm index e75d558f15a..c4ca396282e 100755 --- a/build-system/scripts/deploy_npm +++ b/build-system/scripts/deploy_npm @@ -9,6 +9,7 @@ readonly STANDALONE=${3:-} # Only publish tagged commits to npm. [ -n "${COMMIT_TAG:-}" ] || { echo "Will only publish tagged commits to npm. Skipping." && exit 0; } +retry ecr_login extract_repo $REPOSITORY /usr/src project cd project/src/$(query_manifest relativeProjectDir $REPOSITORY) diff --git a/build-system/scripts/deploy_s3 b/build-system/scripts/deploy_s3 index 87acbf004d9..e793083e27c 100755 --- a/build-system/scripts/deploy_s3 +++ b/build-system/scripts/deploy_s3 @@ -13,6 +13,7 @@ echo "deploy_s3: Project Dir: $PROJECT_DIR" echo "deploy_s3: Working directory: $PWD" echo "deploy_s3: Extract dir: $EXTRACT_DIR" +retry ecr_login extract_repo $REPOSITORY /usr/src/$(query_manifest relativeProjectDir $REPOSITORY)/dest $EXTRACT_DIR # So a front-end app can discover it's deploy tag at runtime, we include a file called DEPLOY_TAG in the root. diff --git a/build-system/scripts/extract_repo b/build-system/scripts/extract_repo index f1fc2d44a86..9adadf2d62c 100755 --- a/build-system/scripts/extract_repo +++ b/build-system/scripts/extract_repo @@ -12,7 +12,6 @@ if docker image ls --format "{{.Repository}}:{{.Tag}}" | grep -q -w "$IMAGE_COMM echo -e "Image exists locally. No need to pull." else echo "Pulling $IMAGE_COMMIT_URI..." - retry ecr_login retry docker pull $IMAGE_COMMIT_URI fi TEMP_CONTAINER=$(docker create $IMAGE_COMMIT_URI dummy_cmd) diff --git a/docs/deploy_netlify.sh b/docs/deploy_netlify.sh index b6fd88ee84e..cb9f7a94e03 100755 --- a/docs/deploy_netlify.sh +++ b/docs/deploy_netlify.sh @@ -2,6 +2,7 @@ [ -n "${BUILD_SYSTEM_DEBUG:-}" ] && set -x # conditionally trace set -eu +retry ecr_login extract_repo docs /usr/src extracted-repo cd extracted-repo/src/docs npm install netlify-cli -g @@ -12,7 +13,7 @@ DEPLOY_OUTPUT="" if [ "$1" = "master" ]; then # Deploy to production if the argument is "master" DEPLOY_OUTPUT=$(netlify deploy --site aztec-docs-dev --prod) -else +else # TODO we should prob see if check_rebuild can be used for this PR_URL="$2" API_URL="${PR_URL/github.com/api.github.com/repos}" diff --git a/yarn-project/deploy_npm.sh b/yarn-project/deploy_npm.sh index 87b3ac7619b..04bf9c6e4d3 100755 --- a/yarn-project/deploy_npm.sh +++ b/yarn-project/deploy_npm.sh @@ -7,6 +7,7 @@ if [ -z "$COMMIT_TAG" ]; then exit 0 fi +retry ecr_login extract_repo yarn-project-prod /usr/src project cd project/src/yarn-project