Skip to content

Commit

Permalink
fix: independent repos
Browse files Browse the repository at this point in the history
  • Loading branch information
Maddiaa0 committed Oct 25, 2023
1 parent 90a53e2 commit c7fff62
Showing 1 changed file with 25 additions and 13 deletions.
38 changes: 25 additions & 13 deletions yarn-project/boxes/run_tests
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,43 @@ BOX_NAME=${1:-boxes-blank}

cd $CURRENT_DIR/$BOX_NAME

export COMPOSE_FILE=${1:-docker-compose.yml}
export COMPOSE_FILE=${2:-docker-compose.yml}

ecr_login

REPO=aztec-sandbox
SANDBOX=aztec-sandbox
YARN_PROJECT=yarn-project

ensure_repo $REPO $ECR_REGION refresh_lifecycle
CONTENT_HASH=$(calculate_content_hash $REPO)
BASE_TAG=cache-$CONTENT_HASH
SANDBOX_IMAGE_URI=$(calculate_image_uri $SANDBOX)
YP_IMAGE_URI=$(calculate_image_uri $YARN_PROJECT)

ensure_repo $SANDBOX $ECR_REGION refresh_lifecycle
CONTENT_HASH=$(calculate_content_hash $SANDBOX)
BASE_TAG=cache-$CONTENT_HASH-$BOX_NAME # Append the box name to seperate the tag
SUCCESS_TAG=$BASE_TAG

echo "Content hash: $CONTENT_HASH"
if check_rebuild $SUCCESS_TAG $REPO; then
if check_rebuild $SUCCESS_TAG $SANDBOX; then
echo "No rebuild required."
retry tag_remote_image $SANDBOX $BASE_TAG $SUCCESS_TAG
exit 0
fi

echo "pulling docker image for $REPO $(calculate_image_uri $REPO)-x86_64"
retry docker pull $(calculate_image_uri $REPO)-x86_64
retry docker tag $(calculate_image_uri $REPO)-x86_64 aztecprotocol/$REPO:latest

REPO=yarn-project
echo "pulling docker image for $REPO $(calculate_image_uri $REPO)"
retry docker pull $(calculate_image_uri $REPO)
retry docker tag $(calculate_image_uri $REPO) aztecprotocol/$REPO:latest
echo "pulling docker image for $SANDBOX $SANDBOX_IMAGE_URI-x86_64"
retry docker pull $SANDBOX_IMAGE_URI-x86_64
retry docker tag $SANDBOX_IMAGE_URI-x86_64 aztecprotocol/$SANDBOX:latest

echo "pulling docker image for $YARN_PROJECT $YP_IMAGE_URI"
retry docker pull $YP_IMAGE_URI
retry docker tag $YP_IMAGE_URI aztecprotocol/$YARN_PROJECT:latest

docker-compose rm -f
docker-compose -f $COMPOSE_FILE up --exit-code-from boxes-$BOX_NAME



# Success - push a new tag for the commit hash.
IMAGE_COMMIT_URI=$SANDBOX_IMAGE_URI-$BOX_NAME
retry docker tag $SANDBOX_IMAGE_URI-x86_64 $IMAGE_COMMIT_URI
retry docker push $IMAGE_COMMIT_URI > /dev/null 2>&1

0 comments on commit c7fff62

Please sign in to comment.