Skip to content

chore!: refactor avm tx execution to generate skipped phase events #270

chore!: refactor avm tx execution to generate skipped phase events

chore!: refactor avm tx execution to generate skipped phase events #270

name: Deploy Eth Devnet

Check failure on line 1 in .github/workflows/deploy-eth-devnet.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/deploy-eth-devnet.yml

Invalid workflow file

you may only define up to 10 `inputs` for a `workflow_dispatch` event
# This workflow is used to deploy the eth devnet to a cluster.
# It can be used to deploy to kind or a GKE cluster.
#
# Set yourself up to run locally with:
# export GOOGLE_APPLICATION_CREDENTIALS=/your/path/to/testnet-helm-sa.json
# alias lwfl=/your/path/to/aztec-clones/alpha/.github/local_workflow.sh
#
# Then deploy to kind:
# lwfl deploy_eth_devnet --input cluster=kind --input resource_profile=dev --input namespace=mitch-eth-devnet --input create_static_ips=false
#
# Or to a GKE cluster:
# lwfl deploy_eth_devnet --input cluster=aztec-gke-private --input resource_profile=prod --input namespace=mitch-eth-devnet --input create_static_ips=false
on:
workflow_call:
inputs:
cluster:
description: The cluster to deploy to, e.g. aztec-gke-private or kind
required: true
type: string
namespace:
description: The namespace to deploy to
required: true
type: string
ref:
description: The branch name to deploy from
required: true
type: string
chain_id:
description: Ethereum chain ID for genesis generation
required: false
type: number
default: 1337
block_time:
description: Block time in seconds for genesis generation
required: false
type: number
default: 12
gas_limit:
description: Gas limit for blocks in genesis generation
required: false
type: string
default: "32000000"
resource_profile:
description: Resource profile to use (dev or prod)
required: true
type: string
create_static_ips:
description: Whether to create static IPs as part of the eth devnet for the execution and beacon nodes
required: true
type: string
run_terraform_destroy:
description: Whether to run the terraform destroy
required: false
type: string
default: "false"
mnemonic:
description: The mnemonic to use for the eth devnet
required: false
type: string
default: "test test test test test test test test test test test junk"
prefunded_mnemonic_indices:
description: The indices of the prefunded mnemonic to use for the devnet
required: false
type: string
default: "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1000,1001,1002,1003"
secrets:
GCP_SA_KEY:
description: The JSON key for the GCP service account
required: true
KUBECONFIG_B64:
description: The base64 encoded kubeconfig
required: true
outputs:
rpc_url:
description: The RPC URL for the eth devnet
value: ${{ jobs.deploy_eth_devnet.outputs.rpc_url }}
ws_url:
description: The WebSocket URL for the eth devnet
value: ${{ jobs.deploy_eth_devnet.outputs.ws_url }}
beacon_url:
description: The Beacon URL for the eth devnet
value: ${{ jobs.deploy_eth_devnet.outputs.beacon_url }}
chain_id:
description: The chain ID for the eth devnet
value: ${{ jobs.deploy_eth_devnet.outputs.chain_id }}
workflow_dispatch:
inputs:
cluster:
description: The cluster to deploy to, e.g. aztec-gke-private or kind
required: true
type: string
namespace:
description: The namespace to deploy to
required: true
type: string
ref:
description: The branch name to deploy from.
required: true
type: string
chain_id:
description: Ethereum chain ID for genesis generation
required: false
type: number
default: 1337
block_time:
description: Block time in seconds for genesis generation
required: false
type: number
default: 12
gas_limit:
description: Gas limit for blocks in genesis generation
required: false
type: string
default: "32000000"
resource_profile:
description: Resource profile to use (dev or prod)
required: true
type: string
create_static_ips:
description: Whether to create static IPs as part of the eth devnet for the execution and beacon nodes
required: true
type: string
run_terraform_destroy:
description: Whether to run the terraform destroy
required: false
type: string
default: "false"
mnemonic:
description: The mnemonic to use for the eth devnet
required: false
type: string
default: "test test test test test test test test test test test junk"
prefunded_mnemonic_indices:
description: The indices of the prefunded mnemonic to use for the devnet
required: false
type: string
default: "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1000,1001,1002,1003"
jobs:
deploy_eth_devnet:
runs-on: ubuntu-latest
outputs:
rpc_url: ${{ steps.get-eth-devnet-results.outputs.rpc_url }}
ws_url: ${{ steps.get-eth-devnet-results.outputs.ws_url }}
beacon_url: ${{ steps.get-eth-devnet-results.outputs.beacon_url }}
chain_id: ${{ steps.get-eth-devnet-results.outputs.chain_id }}
env:
TF_STATE_BUCKET: aztec-terraform
REGION: us-west1-a
# Common Terraform variables as environment variables
TF_VAR_NAMESPACE: ${{ inputs.namespace }}
TF_VAR_CHAIN_ID: ${{ inputs.chain_id }}
TF_VAR_BLOCK_TIME: ${{ inputs.block_time }}
TF_VAR_GAS_LIMIT: ${{ inputs.gas_limit }}
TF_VAR_PREFUNDED_MNEMONIC_INDICES: ${{ inputs.prefunded_mnemonic_indices }}
TF_VAR_RESOURCE_PROFILE: ${{ inputs.resource_profile }}
steps:
- name: Mask the mnemonic
id: mask-mnemonic
run: |
echo "::add-mask::${{ inputs.mnemonic }}"
- name: Debug inputs
run: |
echo "cluster: ${{ inputs.cluster }}"
echo "namespace: ${{ inputs.namespace }}"
echo "ref: ${{ inputs.ref }}"
echo "chain_id: ${{ inputs.chain_id }}"
echo "block_time: ${{ inputs.block_time }}"
echo "gas_limit: ${{ inputs.gas_limit }}"
echo "resource_profile: ${{ inputs.resource_profile }}"
echo "create_static_ips: ${{ inputs.create_static_ips }}"
echo "run_terraform_destroy: ${{ inputs.run_terraform_destroy }}"
- name: Setup K8s and Terraform
uses: ./.github/actions/setup-k8s-terraform
with:
cluster: ${{ inputs.cluster }}
namespace: ${{ inputs.namespace }}
ref: ${{ inputs.ref || github.ref }}
gcp_sa_key: ${{ secrets.GCP_SA_KEY }}
kubeconfig_b64: ${{ secrets.KUBECONFIG_B64 }}
terraform_dir: ./spartan/terraform/deploy-eth-devnet
tf_state_prefix: deploy-eth-devnet
run_terraform_destroy: ${{ inputs.run_terraform_destroy }}
- name: Set up CREATE_STATIC_IPS variable
run: |
# Set CREATE_STATIC_IPS based on cluster type
if [ "${{ inputs.cluster }}" == "kind" ]; then
CREATE_STATIC_IPS=false
else
if [ "${{ inputs.create_static_ips }}" == "true" ]; then
CREATE_STATIC_IPS=true
else
CREATE_STATIC_IPS=false
fi
fi
echo "TF_VAR_CREATE_STATIC_IPS=${CREATE_STATIC_IPS}" >> $GITHUB_ENV
- name: Terraform Plan
working-directory: ./spartan/terraform/deploy-eth-devnet
run: |
# All variables are now set as TF_VAR_ environment variables
terraform plan -out=tfplan
- name: Terraform Apply
working-directory: ./spartan/terraform/deploy-eth-devnet
run: |
terraform apply tfplan
- name: Get eth devnet deployment results
id: get-eth-devnet-results
working-directory: ./spartan/terraform/deploy-eth-devnet
run: |
echo "=== Eth Devnet Deployment Results ==="
# Get outputs from the eth-devnet deployment
RPC_URL=$(terraform output -raw eth_execution_rpc_url)
WS_URL=$(terraform output -raw eth_execution_ws_url)
BEACON_URL=$(terraform output -raw eth_beacon_api_url)
CHAIN_ID=$(terraform output -raw chain_id)
echo "RPC_URL: $RPC_URL"
echo "WS_URL: $WS_URL"
echo "BEACON_URL: $BEACON_URL"
echo "CHAIN_ID: $CHAIN_ID"
# Export as outputs for other steps
echo "rpc_url=$RPC_URL" >> $GITHUB_OUTPUT
echo "ws_url=$WS_URL" >> $GITHUB_OUTPUT
echo "beacon_url=$BEACON_URL" >> $GITHUB_OUTPUT
echo "chain_id=$CHAIN_ID" >> $GITHUB_OUTPUT