From 00aaef6a544580d8ec8a0bb64ca4c40a185b6410 Mon Sep 17 00:00:00 2001 From: Alex Gherghisan Date: Fri, 6 Dec 2024 15:41:41 +0000 Subject: [PATCH] fix: tf vars (#10457) Please read [contributing guidelines](CONTRIBUTING.md) and remove this line. --- .github/workflows/devnet-deploy.yml | 20 +++++++++---------- .github/workflows/network-deploy.yml | 10 +++++----- .../templates/deploy-l1-verifier.yaml | 5 +++++ .../templates/setup-l2-contracts.yaml | 4 ++++ spartan/terraform/deploy-release/main.tf | 5 +++-- spartan/terraform/deploy-release/variables.tf | 2 +- .../cli/src/cmds/devnet/bootstrap_network.ts | 1 + 7 files changed, 29 insertions(+), 18 deletions(-) diff --git a/.github/workflows/devnet-deploy.yml b/.github/workflows/devnet-deploy.yml index f49feb403a3..4c4e5a7384f 100644 --- a/.github/workflows/devnet-deploy.yml +++ b/.github/workflows/devnet-deploy.yml @@ -36,7 +36,7 @@ jobs: uses: ./.github/workflows/network-deploy.yml with: namespace: ${{ github.event.inputs.namespace }} - values_file: release-devnet + values_file: release-devnet.yaml aztec_docker_image: ${{ github.event.inputs.aztec_docker_image }} deployment_mnemonic_secret_name: ${{ github.event.inputs.deployment_mnemonic_secret_name }} respect_tf_lock: ${{ github.event.inputs.respect_tf_lock }} @@ -48,8 +48,6 @@ jobs: runs-on: ubuntu-latest needs: deploy-network steps: - - uses: ./.github/ci-setup-action - - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v1 with: @@ -97,7 +95,7 @@ jobs: trap cleanup EXIT echo "Waiting for PXE pods to be ready..." - if ! kubectl wait --for=condition=ready pod -l app=$NAMESPACE-aztec-network-pxe --timeout=10m; then + if ! kubectl wait -n $NAMESPACE --for=condition=ready pod -l app=pxe --timeout=10m; then echo "Error: PXE pods did not become ready within timeout" exit 1 fi @@ -105,7 +103,7 @@ jobs: helm get values $NAMESPACE -n $NAMESPACE -o json --all > helm_values.json PXE_PORT="$(jq -r .pxe.service.nodePort helm_values.json)" - ETHEREUM_PORT="$(jq -r ethereum.service.port helm_values.json)" + ETHEREUM_PORT="$(jq -r .ethereum.service.port helm_values.json)" L1_CHAIN_ID="$(jq -r .ethereum.chainId helm_values.json)" MNEMONIC="$(jq -r .aztec.l1DeploymentMnemonic helm_values.json)" @@ -115,18 +113,20 @@ jobs: kubectl port-forward -n $NAMESPACE svc/$NAMESPACE-aztec-network-pxe $PXE_PORT & pxe_port_forward_pid=$! - kubectl port-forward -n $NAMESPACE svc/$NAMESPACE-aztec-network-ethereum $ETHEREUM_PORT & + + # port-forward directly to the pod because the Eth node does not have a service definition + ETH_POD_NAME=$(kubectl get pods -n $NAMESPACE -l app=ethereum -o jsonpath='{.items[0].metadata.name}') + kubectl port-forward -n $NAMESPACE pod/$ETH_POD_NAME $ETHEREUM_PORT & ethereum_port_forward_pid=$! # wait for port-forwards to establish sleep 5 - docker run --rm $AZTEC_DOCKER_IMAGE bootstrap-network \ - --network host \ + docker run --rm --network host $AZTEC_DOCKER_IMAGE bootstrap-network \ --rpc-url http://127.0.0.1:$PXE_PORT \ --l1-rpc-url http://127.0.0.1:$ETHEREUM_PORT \ - --l1-chain-id $CHAIN_ID \ - --mnemonic $MNEMONIC \ + --l1-chain-id "$L1_CHAIN_ID" \ + --mnemonic "$MNEMONIC" \ --json | tee ./basic_contracts.json aws s3 cp ./basic_contracts.json ${{ env.CONTRACT_S3_BUCKET }}/devnet/basic_contracts.json diff --git a/.github/workflows/network-deploy.yml b/.github/workflows/network-deploy.yml index b497a5a6142..2d48e35c9e1 100644 --- a/.github/workflows/network-deploy.yml +++ b/.github/workflows/network-deploy.yml @@ -120,11 +120,11 @@ jobs: working-directory: ./spartan/terraform/deploy-release run: | terraform plan \ - -var="release_name=${{ env.NAMESPACE }}" \ - -var="values_file=${{ env.VALUES_FILE }}" \ - -var="gke_cluster_context=${{ env.GKE_CLUSTER_CONTEXT }}" \ - -var="aztec_docker_image=${{ env.AZTEC_DOCKER_IMAGE }}" \ - -var="l1_deployment_mnemonic=${{ steps.get-mnemonic.outputs.mnemonic }}" \ + -var="RELEASE_NAME=${{ env.NAMESPACE }}" \ + -var="VALUES_FILE=${{ env.VALUES_FILE }}" \ + -var="GKE_CLUSTER_CONTEXT=${{ env.GKE_CLUSTER_CONTEXT }}" \ + -var="AZTEC_DOCKER_IMAGE=${{ env.AZTEC_DOCKER_IMAGE }}" \ + -var="L1_DEPLOYMENT_MNEMONIC=${{ steps.get-mnemonic.outputs.mnemonic }}" \ -out=tfplan \ -lock=${{ inputs.respect_tf_lock }} diff --git a/spartan/aztec-network/templates/deploy-l1-verifier.yaml b/spartan/aztec-network/templates/deploy-l1-verifier.yaml index c3edb5d42ff..b69dcd58f65 100644 --- a/spartan/aztec-network/templates/deploy-l1-verifier.yaml +++ b/spartan/aztec-network/templates/deploy-l1-verifier.yaml @@ -5,6 +5,11 @@ metadata: name: {{ include "aztec-network.fullname" . }}-deploy-l1-verifier labels: {{- include "aztec-network.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": post-install + "helm.sh/hook-weight": "0" + "helm.sh/hook-delete-policy": before-hook-creation + spec: template: metadata: diff --git a/spartan/aztec-network/templates/setup-l2-contracts.yaml b/spartan/aztec-network/templates/setup-l2-contracts.yaml index 8afc65abb66..c3167e89109 100644 --- a/spartan/aztec-network/templates/setup-l2-contracts.yaml +++ b/spartan/aztec-network/templates/setup-l2-contracts.yaml @@ -5,6 +5,10 @@ metadata: name: {{ include "aztec-network.fullname" . }}-setup-l2-contracts labels: {{- include "aztec-network.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": post-install + "helm.sh/hook-weight": "0" + "helm.sh/hook-delete-policy": before-hook-creation spec: template: metadata: diff --git a/spartan/terraform/deploy-release/main.tf b/spartan/terraform/deploy-release/main.tf index 4f525c1388f..73eba9e5b37 100644 --- a/spartan/terraform/deploy-release/main.tf +++ b/spartan/terraform/deploy-release/main.tf @@ -6,7 +6,7 @@ terraform { required_providers { helm = { source = "hashicorp/helm" - version = "~> 2.12.1" + version = "~> 2.16.1" } kubernetes = { source = "hashicorp/kubernetes" @@ -37,6 +37,7 @@ resource "helm_release" "aztec-gke-cluster" { chart = "aztec-network" namespace = var.RELEASE_NAME create_namespace = true + upgrade_install = true # base values file values = [file("../../aztec-network/values/${var.VALUES_FILE}")] @@ -48,7 +49,7 @@ resource "helm_release" "aztec-gke-cluster" { set { name = "aztec.l1DeploymentMnemonic" - value = var.l1_deployment_mnemonic + value = var.L1_DEPLOYMENT_MNEMONIC } # Setting timeout and wait conditions diff --git a/spartan/terraform/deploy-release/variables.tf b/spartan/terraform/deploy-release/variables.tf index 369218d3ede..0dff0d4509b 100644 --- a/spartan/terraform/deploy-release/variables.tf +++ b/spartan/terraform/deploy-release/variables.tf @@ -19,7 +19,7 @@ variable "AZTEC_DOCKER_IMAGE" { type = string } -variable "l1_deployment_mnemonic" { +variable "L1_DEPLOYMENT_MNEMONIC" { description = "Mnemonic to use for the L1 contract deployments" type = string sensitive = true diff --git a/yarn-project/cli/src/cmds/devnet/bootstrap_network.ts b/yarn-project/cli/src/cmds/devnet/bootstrap_network.ts index 12073936e11..12b283cbdfd 100644 --- a/yarn-project/cli/src/cmds/devnet/bootstrap_network.ts +++ b/yarn-project/cli/src/cmds/devnet/bootstrap_network.ts @@ -130,6 +130,7 @@ async function deployERC20({ walletClient, publicClient }: L1Clients) { publicClient, erc20.contractAbi, erc20.contractBytecode, + ['DevCoin', 'DEV', walletClient.account.address], ); const { address: portalAddress } = await deployL1Contract( walletClient,