-
Notifications
You must be signed in to change notification settings - Fork 295
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: run check rebuild on boxes (#3000)
Builds ontop of the run_tests script for the boxes such that: 1. They share one script 2. They are tagged at the end ( aztec-sandbox ecr suffixed with the box name ) 3. Only run if the sandbox has changed or if they have previously failed
- Loading branch information
Showing
5 changed files
with
66 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/bin/bash | ||
# This script is used to run an e2e type test in CI (see .circleci/config.yml). | ||
# It pulls images and runs docker-compose, which has the test as the entrypoint. | ||
[ -n "${BUILD_SYSTEM_DEBUG:-}" ] && set -x # conditionally trace | ||
set -eu | ||
|
||
# The box name is the name of the directory containing the docker-compose.yml file | ||
# The current dir is assumed to be `yarn-project/boxes`, as this script `yarn-project/boxes/run_tests` | ||
CURRENT_DIR=`dirname $0` | ||
BOX_NAME=${1:-boxes-blank} | ||
|
||
cd $CURRENT_DIR/$BOX_NAME | ||
|
||
export COMPOSE_FILE=${2:-docker-compose.yml} | ||
|
||
ecr_login | ||
|
||
# There are two dependent docker images, sandbox and yarn-project | ||
# We must pull their ecr images, then retag them in ci as local images for our docker compose to work. | ||
SANDBOX=aztec-sandbox | ||
YARN_PROJECT=yarn-project | ||
|
||
SANDBOX_IMAGE_URI=$(calculate_image_uri $SANDBOX) | ||
YP_IMAGE_URI=$(calculate_image_uri $YARN_PROJECT) | ||
|
||
################### CHECK REBUILD ################### | ||
# Before doing any work we check if we need to rebuild | ||
# Each box is suffixed with the box name, such that rebuilding of each box is independent, if one fails we don't rebuild the others | ||
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 $SANDBOX; then | ||
echo "No rebuild required." | ||
retry tag_remote_image $SANDBOX $BASE_TAG $SUCCESS_TAG | ||
exit 0 | ||
fi | ||
|
||
################### PREAMBLE ################### | ||
|
||
# Pull images from ecr and retag for the docker compsoe | ||
SANDBOX_IMAGE=$SANDBOX_IMAGE_URI-x86_64 | ||
echo "pulling docker image for $SANDBOX $SANDBOX_IMAGE" | ||
retry docker pull $SANDBOX_IMAGE | ||
retry docker tag $SANDBOX_IMAGE 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 | ||
|
||
################### RUN TESTS ################### | ||
|
||
docker-compose rm -f | ||
docker-compose -f $COMPOSE_FILE up --exit-code-from boxes-$BOX_NAME | ||
|
||
################### POST TEST ################### | ||
|
||
# Success - push a new tag for the commit hash with the box name appended | ||
IMAGE_COMMIT_URI=$SANDBOX_IMAGE_URI-$BOX_NAME | ||
retry docker tag $SANDBOX_IMAGE $IMAGE_COMMIT_URI | ||
retry docker push $IMAGE_COMMIT_URI > /dev/null 2>&1 |
This file was deleted.
Oops, something went wrong.