diff --git a/.circleci/config.yml b/.circleci/config.yml index 2b0d5c488d2..bc2958989a1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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: | @@ -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 diff --git a/iac/mainnet-fork/terraform/main.tf b/iac/mainnet-fork/terraform/main.tf index 08198ba5e0b..e8978b48120 100644 --- a/iac/mainnet-fork/terraform/main.tf +++ b/iac/mainnet-fork/terraform/main.tf @@ -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" { diff --git a/l1-contracts/scripts/ci_deploy_contracts.sh b/l1-contracts/scripts/ci_deploy_contracts.sh index a3ccd71600b..914e28f128e 100755 --- a/l1-contracts/scripts/ci_deploy_contracts.sh +++ b/l1-contracts/scripts/ci_deploy_contracts.sh @@ -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