Apply suggestions from code review #516
Workflow file for this run
This file contains hidden or 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
name: Deploy Aztec Infra | ||
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 | ||
run_terraform_destroy: | ||
description: Whether to run terraform destroy | ||
required: true | ||
type: boolean | ||
default: false | ||
aztec_docker_image: | ||
description: The Aztec Docker image to deploy | ||
required: true | ||
type: string | ||
l1_rpc_urls: | ||
description: L1 RPC URLs as JSON array | ||
required: true | ||
type: string | ||
l1_consensus_host_urls: | ||
description: L1 consensus host URLs as JSON array | ||
required: true | ||
type: string | ||
l1_consensus_host_api_keys: | ||
description: L1 consensus host API keys as JSON array | ||
required: true | ||
type: string | ||
l1_consensus_host_api_key_headers: | ||
description: L1 consensus host API key headers as JSON array | ||
required: true | ||
type: string | ||
l1_chain_id: | ||
description: L1 chain ID | ||
required: true | ||
type: string | ||
registry_address: | ||
description: Registry contract address | ||
required: true | ||
type: string | ||
slash_factory_address: | ||
description: Slash factory contract address | ||
required: true | ||
type: string | ||
fee_asset_handler_address: | ||
description: Fee asset handler contract address | ||
required: true | ||
type: string | ||
validator_mnemonic: | ||
description: Validator mnemonic phrase | ||
required: true | ||
type: string | ||
validator_mnemonic_start_index: | ||
description: Validator mnemonic start index | ||
required: true | ||
type: number | ||
validators_per_node: | ||
description: Number of validators per node | ||
required: true | ||
type: number | ||
validator_replicas: | ||
description: Number of validator replicas | ||
required: true | ||
type: number | ||
prover_mnemonic: | ||
description: Prover mnemonic phrase | ||
required: true | ||
type: string | ||
prover_mnemonic_start_index: | ||
description: Prover mnemonic start index | ||
required: true | ||
type: number | ||
p2p_bootstrap_resource_profile: | ||
description: P2P bootstrap resource profile | ||
required: true | ||
type: string | ||
validator_resource_profile: | ||
description: Validator resource profile | ||
required: true | ||
type: string | ||
prover_resource_profile: | ||
description: Prover resource profile | ||
required: true | ||
type: string | ||
rpc_resource_profile: | ||
description: RPC resource profile | ||
required: true | ||
type: string | ||
rpc_external_ingress: | ||
description: Whether to use an external ingress for the rpc | ||
required: true | ||
type: boolean | ||
otel_collector_url: | ||
description: The OpenTelemetry collector that will receive metrics from this deployment. Optional | ||
required: false | ||
type: string | ||
secrets: | ||
GCP_SA_KEY: | ||
description: The GCP service account key | ||
required: true | ||
KUBECONFIG_B64: | ||
description: The base64 encoded kubeconfig | ||
required: true | ||
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 | ||
run_terraform_destroy: | ||
description: Whether to run terraform destroy | ||
required: true | ||
type: boolean | ||
default: false | ||
aztec_docker_image: | ||
description: The Aztec Docker image to deploy | ||
required: true | ||
type: string | ||
l1_rpc_urls: | ||
description: L1 RPC URLs as JSON array. Format, e.g. ["http://10.96.142.184:8545"] | ||
required: true | ||
type: string | ||
l1_consensus_host_urls: | ||
description: L1 consensus host URLs as JSON array. Format, e.g. ["http://10.96.36.205:5052"] | ||
required: true | ||
type: string | ||
l1_consensus_host_api_keys: | ||
description: L1 consensus host API keys as JSON array. Format, e.g. ["1234567890"] | ||
required: true | ||
type: string | ||
l1_consensus_host_api_key_headers: | ||
description: L1 consensus host API key headers as JSON array. Format, e.g. ["X-API-Key"] | ||
required: true | ||
type: string | ||
l1_chain_id: | ||
description: L1 chain ID | ||
required: true | ||
type: string | ||
registry_address: | ||
description: Registry contract address | ||
required: true | ||
type: string | ||
slash_factory_address: | ||
description: Slash factory contract address | ||
required: true | ||
type: string | ||
fee_asset_handler_address: | ||
description: Fee asset handler contract address | ||
required: true | ||
type: string | ||
validator_mnemonic: | ||
description: Validator mnemonic phrase | ||
required: true | ||
type: string | ||
validator_mnemonic_start_index: | ||
description: Validator mnemonic start index | ||
required: true | ||
type: number | ||
validators_per_node: | ||
description: Number of validators per node | ||
required: true | ||
type: number | ||
validator_replicas: | ||
description: Number of validator replicas | ||
required: true | ||
type: number | ||
prover_mnemonic: | ||
description: Prover mnemonic phrase | ||
required: true | ||
type: string | ||
prover_mnemonic_start_index: | ||
description: Prover mnemonic start index | ||
required: true | ||
type: number | ||
p2p_bootstrap_resource_profile: | ||
description: P2P bootstrap resource profile | ||
required: true | ||
type: string | ||
validator_resource_profile: | ||
description: Validator resource profile | ||
required: true | ||
type: string | ||
prover_resource_profile: | ||
description: Prover resource profile | ||
required: true | ||
type: string | ||
rpc_resource_profile: | ||
description: RPC resource profile | ||
required: true | ||
type: string | ||
rpc_external_ingress: | ||
description: Whether to use an external ingress for the rpc | ||
required: true | ||
type: boolean | ||
otel_collector_url: | ||
description: The OpenTelemetry collector that will receive metrics from this deployment. Optional | ||
required: false | ||
type: string | ||
jobs: | ||
deploy_aztec_infra: | ||
runs-on: ubuntu-latest | ||
env: | ||
TF_VAR_RELEASE_PREFIX: aztec-infra | ||
TF_VAR_GCP_PROJECT: "testnet-440309" | ||
TF_VAR_GCP_REGION: us-west1 | ||
TF_VAR_K8S_CLUSTER_CONTEXT: ${{ inputs.cluster }} | ||
TF_VAR_NAMESPACE: ${{ inputs.namespace }} | ||
TF_VAR_AZTEC_DOCKER_IMAGE: ${{ inputs.aztec_docker_image }} | ||
TF_VAR_L1_RPC_URLS: ${{ inputs.l1_rpc_urls }} | ||
TF_VAR_L1_CONSENSUS_HOST_URLS: ${{ inputs.l1_consensus_host_urls }} | ||
TF_VAR_L1_CONSENSUS_HOST_API_KEYS: ${{ inputs.l1_consensus_host_api_keys }} | ||
TF_VAR_L1_CONSENSUS_HOST_API_KEY_HEADERS: ${{ inputs.l1_consensus_host_api_key_headers }} | ||
TF_VAR_L1_CHAIN_ID: ${{ inputs.l1_chain_id }} | ||
TF_VAR_REGISTRY_CONTRACT_ADDRESS: ${{ inputs.registry_address }} | ||
TF_VAR_SLASH_FACTORY_CONTRACT_ADDRESS: ${{ inputs.slash_factory_address }} | ||
TF_VAR_FEE_ASSET_HANDLER_CONTRACT_ADDRESS: ${{ inputs.fee_asset_handler_address }} | ||
TF_VAR_VALIDATOR_MNEMONIC: ${{ inputs.validator_mnemonic }} | ||
TF_VAR_VALIDATOR_MNEMONIC_START_INDEX: ${{ inputs.validator_mnemonic_start_index }} | ||
TF_VAR_VALIDATORS_PER_NODE: ${{ inputs.validators_per_node }} | ||
TF_VAR_VALIDATOR_REPLICAS: ${{ inputs.validator_replicas }} | ||
TF_VAR_PROVER_MNEMONIC: ${{ inputs.prover_mnemonic }} | ||
TF_VAR_PROVER_MNEMONIC_START_INDEX: ${{ inputs.prover_mnemonic_start_index }} | ||
TF_VAR_P2P_BOOTSTRAP_RESOURCE_PROFILE: ${{ inputs.p2p_bootstrap_resource_profile }} | ||
TF_VAR_VALIDATOR_RESOURCE_PROFILE: ${{ inputs.validator_resource_profile }} | ||
TF_VAR_PROVER_RESOURCE_PROFILE: ${{ inputs.prover_resource_profile }} | ||
TF_VAR_RPC_RESOURCE_PROFILE: ${{ inputs.rpc_resource_profile }} | ||
TF_VAR_RPC_EXTERNAL_INGRESS: ${{ inputs.rpc_external_ingress }} | ||
TF_VAR_OTEL_COLLECTOR_URL: ${{ inputs.otel_collector_url }} | ||
steps: | ||
- name: Debug inputs | ||
run: | | ||
echo "cluster: ${{ inputs.cluster }}" | ||
echo "namespace: ${{ inputs.namespace }}" | ||
- 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-aztec-infra | ||
tf_state_prefix: deploy-aztec-infra | ||
run_terraform_destroy: ${{ inputs.run_terraform_destroy }} | ||
- name: Terraform Plan | ||
working-directory: ./spartan/terraform/deploy-aztec-infra | ||
run: | | ||
# All variables are now set as TF_VAR_ environment variables | ||
terraform plan -out=tfplan | ||
- name: Terraform Apply | ||
working-directory: ./spartan/terraform/deploy-aztec-infra | ||
run: | | ||
terraform apply tfplan |