From 1543d964aa30d1c77dee5829852fc91b153af943 Mon Sep 17 00:00:00 2001 From: ludamad Date: Sun, 3 Sep 2023 11:30:04 -0400 Subject: [PATCH] More content hash usage --- circuits/cpp/barretenberg/cpp/scripts/bb-tests.sh | 7 ++----- circuits/cpp/barretenberg/cpp/scripts/bin-test.sh | 7 ++----- .../cpp/scripts/run_aztec_circuits_tests | 4 ++-- circuits/cpp/barretenberg/cpp/scripts/run_tests | 6 ++---- circuits/cpp/scripts/run_tests | 4 +++- yarn-project/canary/scripts/run_tests | 14 +++++--------- yarn-project/end-to-end/scripts/run_tests_local | 10 +++++++--- 7 files changed, 23 insertions(+), 29 deletions(-) diff --git a/circuits/cpp/barretenberg/cpp/scripts/bb-tests.sh b/circuits/cpp/barretenberg/cpp/scripts/bb-tests.sh index d52ffd4c3c0..5c8632142f0 100755 --- a/circuits/cpp/barretenberg/cpp/scripts/bb-tests.sh +++ b/circuits/cpp/barretenberg/cpp/scripts/bb-tests.sh @@ -4,11 +4,8 @@ set -e $(aws ecr get-login --region us-east-2 --no-include-email) 2> /dev/null -export PATH="$PATH:$(git rev-parse --show-toplevel)/build-system/scripts" - -CONTENT_HASH=$(calculate_content_hash barretenberg-x86_64-linux-clang-assert) -IMAGE_URI=278380418400.dkr.ecr.us-east-2.amazonaws.com/barretenberg-x86_64-linux-clang-assert:cache-$CONTENT_HASH - +# use the image rebuild patterns to compute a content hash, use this to get a URI +IMAGE_URI=$($(git rev-parse --show-toplevel)/build-system/scripts/calculate_image_uri barretenberg-x86_64-linux-clang-assert) docker pull $IMAGE_URI TESTS=( diff --git a/circuits/cpp/barretenberg/cpp/scripts/bin-test.sh b/circuits/cpp/barretenberg/cpp/scripts/bin-test.sh index 39255f86a0e..f4a1ecd2316 100755 --- a/circuits/cpp/barretenberg/cpp/scripts/bin-test.sh +++ b/circuits/cpp/barretenberg/cpp/scripts/bin-test.sh @@ -4,11 +4,8 @@ set -eu $(aws ecr get-login --region us-east-2 --no-include-email) 2> /dev/null -export PATH="$PATH:$(git rev-parse --show-toplevel)/build-system/scripts" -REPOSITORY=barretenberg-x86_64-linux-clang-assert -CONTENT_HASH=$(calculate_content_hash $REPOSITORY) -IMAGE_URI=278380418400.dkr.ecr.us-east-2.amazonaws.com/$REPOSITORY:cache-$CONTENT_HASH - +# use the image rebuild patterns to compute a content hash, use this to get a URI +IMAGE_URI=$($(git rev-parse --show-toplevel)/build-system/scripts/calculate_image_uri barretenberg-x86_64-linux-clang-assert) docker pull $IMAGE_URI docker run --rm -t $IMAGE_URI /bin/sh -c "\ diff --git a/circuits/cpp/barretenberg/cpp/scripts/run_aztec_circuits_tests b/circuits/cpp/barretenberg/cpp/scripts/run_aztec_circuits_tests index c18a6c65513..39b54ddb5e6 100755 --- a/circuits/cpp/barretenberg/cpp/scripts/run_aztec_circuits_tests +++ b/circuits/cpp/barretenberg/cpp/scripts/run_aztec_circuits_tests @@ -20,8 +20,8 @@ shift # to aztec's circuits `run_tests_local` $(aws ecr get-login --region us-east-2 --no-include-email) 2> /dev/null REPOSITORY="barretenberg-circuits-${ARCH}-linux-clang-builder-runner" -CONTENT_HASH=$(calculate_content_hash $REPOSITORY) -IMAGE_URI=278380418400.dkr.ecr.us-east-2.amazonaws.com/$REPOSITORY:cache-$CONTENT_HASH +# use the image rebuild patterns to compute a content hash, use this to get a URI +IMAGE_URI=$($(git rev-parse --show-toplevel)/build-system/scripts/calculate_image_uri $REPOSITORY) docker pull $IMAGE_URI if [ "$ARCH" != "wasm" ]; then diff --git a/circuits/cpp/barretenberg/cpp/scripts/run_tests b/circuits/cpp/barretenberg/cpp/scripts/run_tests index 486ae8a50b8..571f77c4204 100755 --- a/circuits/cpp/barretenberg/cpp/scripts/run_tests +++ b/circuits/cpp/barretenberg/cpp/scripts/run_tests @@ -12,10 +12,8 @@ shift $(aws ecr get-login --region us-east-2 --no-include-email) 2> /dev/null -REPOSITORY="barretenberg-x86_64-linux-clang-assert" -CONTENT_HASH=$(calculate_content_hash $REPOSITORY) -IMAGE_URI=278380418400.dkr.ecr.us-east-2.amazonaws.com/$REPOSITORY:cache-$CONTENT_HASH - +# use the image rebuild patterns to compute a content hash, use this to get a URI +IMAGE_URI=$($(git rev-parse --show-toplevel)/build-system/scripts/calculate_image_uri barretenberg-x86_64-linux-clang-assert) docker pull $IMAGE_URI if [ -f "$TESTS" ]; then diff --git a/circuits/cpp/scripts/run_tests b/circuits/cpp/scripts/run_tests index 13f679a3ab6..e41a08c8e9c 100755 --- a/circuits/cpp/scripts/run_tests +++ b/circuits/cpp/scripts/run_tests @@ -25,7 +25,9 @@ shift # arg1 (num transcripts) is not forwarded to `run_tests_local` $(aws ecr get-login --region us-east-2 --no-include-email) 2> /dev/null -IMAGE_URI=278380418400.dkr.ecr.us-east-2.amazonaws.com/circuits-$ARCH-linux-clang-assert:cache-$COMMIT_HASH +REPOSITORY="circuits-$ARCH-linux-clang-assert" +# use the image rebuild patterns to compute a content hash, use this to get a URI +IMAGE_URI=$($(git rev-parse --show-toplevel)/build-system/scripts/calculate_image_uri $REPOSITORY) docker pull $IMAGE_URI # run tests in docker image diff --git a/yarn-project/canary/scripts/run_tests b/yarn-project/canary/scripts/run_tests index a18409b903f..aa9ddf4fd28 100755 --- a/yarn-project/canary/scripts/run_tests +++ b/yarn-project/canary/scripts/run_tests @@ -7,21 +7,17 @@ export TEST=$1 export IMAGE=${2:-canary} export COMPOSE_FILE=${3:-docker-compose.yml} -export PATH="$PATH:$(git rev-parse --show-toplevel)/build-system/scripts" -CONTENT_HASH=$(calculate_content_hash $IMAGE) -echo "Content hash: $CONTENT_HASH" - if [ "$TEST" = "uniswap_trade_on_l1_from_l2.test.ts" ]; then export FORK_URL=https://mainnet.infura.io/v3/9928b52099854248b3a096be07a6b23c export FORK_BLOCK_NUMBER=17514288 fi -if [ -n "$COMMIT_HASH" ]; then - $(aws ecr get-login --region us-east-2 --no-include-email) 2> /dev/null +$(aws ecr get-login --region us-east-2 --no-include-email) 2> /dev/null - docker pull 278380418400.dkr.ecr.us-east-2.amazonaws.com/$IMAGE:cache-$CONTENT_HASH - docker tag 278380418400.dkr.ecr.us-east-2.amazonaws.com/$IMAGE:cache-$CONTENT_HASH aztecprotocol/canary:latest -fi +# use the image rebuild patterns to compute a content hash, use this to get a URI +IMAGE_URI=$($(git rev-parse --show-toplevel)/build-system/scripts/calculate_image_uri $IMAGE) +docker pull $IMAGE_URI +docker tag $IMAGE_URI aztecprotocol/canary:latest docker-compose rm -f docker-compose -f $COMPOSE_FILE up --exit-code-from canary diff --git a/yarn-project/end-to-end/scripts/run_tests_local b/yarn-project/end-to-end/scripts/run_tests_local index 64f0a9f0fcd..9a6fcfcf750 100755 --- a/yarn-project/end-to-end/scripts/run_tests_local +++ b/yarn-project/end-to-end/scripts/run_tests_local @@ -5,14 +5,18 @@ set -e export TEST=$1 export COMPOSE_FILE=${2:-./scripts/docker-compose.yml} - +REPOSITORY=barretenberg-x86_64-linux-clang-assert +CONTENT_HASH=$(calculate_content_hash $REPOSITORY) +# use the image rebuild patterns to compute a content hash, use this to get a URI +IMAGE_URI=$($(git rev-parse --show-toplevel)/build-system/scripts/calculate_image_uri $REPOSITORY) +docker pull $IMAGE_URI if [ -n "$COMMIT_HASH" ]; then aws ecr get-login-password --region us-east-2 | docker login --username AWS --password-stdin 278380418400.dkr.ecr.us-east-2.amazonaws.com for REPO in end-to-end; do - docker pull 278380418400.dkr.ecr.us-east-2.amazonaws.com/$REPO:cache-$COMMIT_HASH - docker tag 278380418400.dkr.ecr.us-east-2.amazonaws.com/$REPO:cache-$COMMIT_HASH aztecprotocol/$REPO:latest + docker pull 278380418400.dkr.ecr.us-east-2.amazonaws.com/$REPO:cache-$CONTENT_HASH + docker tag 278380418400.dkr.ecr.us-east-2.amazonaws.com/$REPO:cache-$CONTENT_HASH aztecprotocol/$REPO:latest done fi