Skip to content

Commit

Permalink
fix: mainnet fork redeploys (#5573)
Browse files Browse the repository at this point in the history
- Different way to 'taint' mainnet fork's EFS storage so it doesn't
redeploy on every commit to `master`
- Deploy fork earlier to ensure availability
- retry runing `deploy-l1-contracts` command in case service is not
available yet
  • Loading branch information
spypsy committed Apr 5, 2024
1 parent d531b25 commit 88e8b6d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
10 changes: 5 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1182,6 +1182,11 @@ jobs:
deploy_dockerhub cli
deploy_dockerhub aztec-faucet
deploy_dockerhub mainnet-fork
- run:
name: "Deploy mainnet fork"
command: |
should_deploy || exit 0
deploy_terraform_services iac/mainnet-fork
- run:
name: "Release canary to NPM: bb.js"
command: |
Expand Down Expand Up @@ -1212,11 +1217,6 @@ jobs:
command: |
should_release || exit 0
deploy_npm l1-contracts latest
- run:
name: "Deploy mainnet fork"
command: |
should_deploy || exit 0
deploy_terraform_services iac/mainnet-fork mainnet-fork mainnet-fork aws_efs_file_system.aztec_mainnet_fork_data_store
- run:
name: "Deploy L1 contracts to mainnet fork"
working_directory: l1-contracts
Expand Down
7 changes: 6 additions & 1 deletion iac/mainnet-fork/terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,17 @@ resource "aws_efs_file_system" "aztec_mainnet_fork_data_store" {
creation_token = "${var.DEPLOY_TAG}-mainnet-fork-data"

tags = {
Name = "${var.DEPLOY_TAG}-mainnet-fork-data"
Name = "${var.DEPLOY_TAG}-mainnet-fork-data"
TaskDefinitionArn = "${aws_ecs_task_definition.aztec_mainnet_fork.arn}" # This line forces recreation on task definition change
}

lifecycle_policy {
transition_to_ia = "AFTER_30_DAYS"
}

lifecycle {
create_before_destroy = true
}
}

resource "aws_efs_mount_target" "aztec_fork_private_az1" {
Expand Down
12 changes: 9 additions & 3 deletions l1-contracts/scripts/ci_deploy_contracts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,15 @@ retry docker pull $CLI_IMAGE

# remove 0x prefix from private key
PRIVATE_KEY=${CONTRACT_PUBLISHER_PRIVATE_KEY#0x}
docker run \
$CLI_IMAGE \
deploy-l1-contracts -u $ETHEREUM_HOST -p $PRIVATE_KEY | tee ./serve/contract_addresses.json

# Retries up to 3 times with 10 second intervals
ATTEMPTS=3
for i in $(seq 1 $ATTEMPTS); do
docker run \
$CLI_IMAGE \
deploy-l1-contracts -u $ETHEREUM_HOST -p $PRIVATE_KEY | tee $FILE_PATH && break
[ "$i" != "$ATTEMPTS" ] && sleep 10
done

## Result format is:
# Rollup Address: 0xe33d37702bb94e83ca09e7dc804c9f4c4ab8ee4a
Expand Down

0 comments on commit 88e8b6d

Please sign in to comment.