Skip to content

Commit

Permalink
More content hash usage
Browse files Browse the repository at this point in the history
  • Loading branch information
ludamad committed Sep 3, 2023
1 parent d3f8ff8 commit 1543d96
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 29 deletions.
7 changes: 2 additions & 5 deletions circuits/cpp/barretenberg/cpp/scripts/bb-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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=(
Expand Down
7 changes: 2 additions & 5 deletions circuits/cpp/barretenberg/cpp/scripts/bin-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 "\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 2 additions & 4 deletions circuits/cpp/barretenberg/cpp/scripts/run_tests
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion circuits/cpp/scripts/run_tests
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 5 additions & 9 deletions yarn-project/canary/scripts/run_tests
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 7 additions & 3 deletions yarn-project/end-to-end/scripts/run_tests_local
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 1543d96

Please sign in to comment.