|
| 1 | +name: Deploy Aztec Infra |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + cluster: |
| 7 | + description: The cluster to deploy to, e.g. aztec-gke-private or kind |
| 8 | + required: true |
| 9 | + type: string |
| 10 | + namespace: |
| 11 | + description: The namespace to deploy to |
| 12 | + required: true |
| 13 | + type: string |
| 14 | + ref: |
| 15 | + description: The branch name to deploy from. |
| 16 | + required: true |
| 17 | + type: string |
| 18 | + run_terraform_destroy: |
| 19 | + description: Whether to run terraform destroy |
| 20 | + required: true |
| 21 | + type: boolean |
| 22 | + default: false |
| 23 | + aztec_docker_image: |
| 24 | + description: The Aztec Docker image to deploy |
| 25 | + required: true |
| 26 | + type: string |
| 27 | + l1_rpc_urls: |
| 28 | + description: L1 RPC URLs as JSON array |
| 29 | + required: true |
| 30 | + type: string |
| 31 | + l1_consensus_host_urls: |
| 32 | + description: L1 consensus host URLs as JSON array |
| 33 | + required: true |
| 34 | + type: string |
| 35 | + l1_consensus_host_api_keys: |
| 36 | + description: L1 consensus host API keys as JSON array |
| 37 | + required: true |
| 38 | + type: string |
| 39 | + l1_consensus_host_api_key_headers: |
| 40 | + description: L1 consensus host API key headers as JSON array |
| 41 | + required: true |
| 42 | + type: string |
| 43 | + l1_chain_id: |
| 44 | + description: L1 chain ID |
| 45 | + required: true |
| 46 | + type: string |
| 47 | + registry_address: |
| 48 | + description: Registry contract address |
| 49 | + required: true |
| 50 | + type: string |
| 51 | + slash_factory_address: |
| 52 | + description: Slash factory contract address |
| 53 | + required: true |
| 54 | + type: string |
| 55 | + fee_asset_handler_address: |
| 56 | + description: Fee asset handler contract address |
| 57 | + required: true |
| 58 | + type: string |
| 59 | + validator_mnemonic: |
| 60 | + description: Validator mnemonic phrase |
| 61 | + required: true |
| 62 | + type: string |
| 63 | + validator_mnemonic_start_index: |
| 64 | + description: Validator mnemonic start index |
| 65 | + required: true |
| 66 | + type: number |
| 67 | + validators_per_node: |
| 68 | + description: Number of validators per node |
| 69 | + required: true |
| 70 | + type: number |
| 71 | + validator_replicas: |
| 72 | + description: Number of validator replicas |
| 73 | + required: true |
| 74 | + type: number |
| 75 | + prover_mnemonic: |
| 76 | + description: Prover mnemonic phrase |
| 77 | + required: true |
| 78 | + type: string |
| 79 | + prover_mnemonic_start_index: |
| 80 | + description: Prover mnemonic start index |
| 81 | + required: true |
| 82 | + type: number |
| 83 | + p2p_bootstrap_resource_profile: |
| 84 | + description: P2P bootstrap resource profile |
| 85 | + required: true |
| 86 | + type: string |
| 87 | + validator_resource_profile: |
| 88 | + description: Validator resource profile |
| 89 | + required: true |
| 90 | + type: string |
| 91 | + prover_resource_profile: |
| 92 | + description: Prover resource profile |
| 93 | + required: true |
| 94 | + type: string |
| 95 | + rpc_resource_profile: |
| 96 | + description: RPC resource profile |
| 97 | + required: true |
| 98 | + type: string |
| 99 | + rpc_external_ingress: |
| 100 | + description: Whether to use an external ingress for the rpc |
| 101 | + required: true |
| 102 | + type: boolean |
| 103 | + secrets: |
| 104 | + GCP_SA_KEY: |
| 105 | + description: The GCP service account key |
| 106 | + required: true |
| 107 | + KUBECONFIG_B64: |
| 108 | + description: The base64 encoded kubeconfig |
| 109 | + required: true |
| 110 | + |
| 111 | + workflow_dispatch: |
| 112 | + inputs: |
| 113 | + cluster: |
| 114 | + description: The cluster to deploy to, e.g. aztec-gke-private or kind |
| 115 | + required: true |
| 116 | + type: string |
| 117 | + namespace: |
| 118 | + description: The namespace to deploy to |
| 119 | + required: true |
| 120 | + type: string |
| 121 | + ref: |
| 122 | + description: The branch name to deploy from. |
| 123 | + required: true |
| 124 | + type: string |
| 125 | + run_terraform_destroy: |
| 126 | + description: Whether to run terraform destroy |
| 127 | + required: true |
| 128 | + type: boolean |
| 129 | + default: false |
| 130 | + aztec_docker_image: |
| 131 | + description: The Aztec Docker image to deploy |
| 132 | + required: true |
| 133 | + type: string |
| 134 | + l1_rpc_urls: |
| 135 | + description: L1 RPC URLs as JSON array. Format, e.g. ["http://10.96.142.184:8545"] |
| 136 | + required: true |
| 137 | + type: string |
| 138 | + l1_consensus_host_urls: |
| 139 | + description: L1 consensus host URLs as JSON array. Format, e.g. ["http://10.96.36.205:5052"] |
| 140 | + required: true |
| 141 | + type: string |
| 142 | + l1_consensus_host_api_keys: |
| 143 | + description: L1 consensus host API keys as JSON array. Format, e.g. ["1234567890"] |
| 144 | + required: true |
| 145 | + type: string |
| 146 | + l1_consensus_host_api_key_headers: |
| 147 | + description: L1 consensus host API key headers as JSON array. Format, e.g. ["X-API-Key"] |
| 148 | + required: true |
| 149 | + type: string |
| 150 | + l1_chain_id: |
| 151 | + description: L1 chain ID |
| 152 | + required: true |
| 153 | + type: string |
| 154 | + registry_address: |
| 155 | + description: Registry contract address |
| 156 | + required: true |
| 157 | + type: string |
| 158 | + slash_factory_address: |
| 159 | + description: Slash factory contract address |
| 160 | + required: true |
| 161 | + type: string |
| 162 | + fee_asset_handler_address: |
| 163 | + description: Fee asset handler contract address |
| 164 | + required: true |
| 165 | + type: string |
| 166 | + validator_mnemonic: |
| 167 | + description: Validator mnemonic phrase |
| 168 | + required: true |
| 169 | + type: string |
| 170 | + validator_mnemonic_start_index: |
| 171 | + description: Validator mnemonic start index |
| 172 | + required: true |
| 173 | + type: number |
| 174 | + validators_per_node: |
| 175 | + description: Number of validators per node |
| 176 | + required: true |
| 177 | + type: number |
| 178 | + validator_replicas: |
| 179 | + description: Number of validator replicas |
| 180 | + required: true |
| 181 | + type: number |
| 182 | + prover_mnemonic: |
| 183 | + description: Prover mnemonic phrase |
| 184 | + required: true |
| 185 | + type: string |
| 186 | + prover_mnemonic_start_index: |
| 187 | + description: Prover mnemonic start index |
| 188 | + required: true |
| 189 | + type: number |
| 190 | + p2p_bootstrap_resource_profile: |
| 191 | + description: P2P bootstrap resource profile |
| 192 | + required: true |
| 193 | + type: string |
| 194 | + validator_resource_profile: |
| 195 | + description: Validator resource profile |
| 196 | + required: true |
| 197 | + type: string |
| 198 | + prover_resource_profile: |
| 199 | + description: Prover resource profile |
| 200 | + required: true |
| 201 | + type: string |
| 202 | + rpc_resource_profile: |
| 203 | + description: RPC resource profile |
| 204 | + required: true |
| 205 | + type: string |
| 206 | + rpc_external_ingress: |
| 207 | + description: Whether to use an external ingress for the rpc |
| 208 | + required: true |
| 209 | + type: boolean |
| 210 | + |
| 211 | +jobs: |
| 212 | + deploy_aztec_infra: |
| 213 | + runs-on: ubuntu-latest |
| 214 | + env: |
| 215 | + TF_VAR_RELEASE_PREFIX: aztec-infra |
| 216 | + TF_VAR_GCP_PROJECT: "testnet-440309" |
| 217 | + TF_VAR_GCP_REGION: us-west1 |
| 218 | + TF_VAR_K8S_CLUSTER_CONTEXT: ${{ inputs.cluster }} |
| 219 | + TF_VAR_NAMESPACE: ${{ inputs.namespace }} |
| 220 | + TF_VAR_AZTEC_DOCKER_IMAGE: ${{ inputs.aztec_docker_image }} |
| 221 | + TF_VAR_L1_RPC_URLS: ${{ inputs.l1_rpc_urls }} |
| 222 | + TF_VAR_L1_CONSENSUS_HOST_URLS: ${{ inputs.l1_consensus_host_urls }} |
| 223 | + TF_VAR_L1_CONSENSUS_HOST_API_KEYS: ${{ inputs.l1_consensus_host_api_keys }} |
| 224 | + TF_VAR_L1_CONSENSUS_HOST_API_KEY_HEADERS: ${{ inputs.l1_consensus_host_api_key_headers }} |
| 225 | + TF_VAR_L1_CHAIN_ID: ${{ inputs.l1_chain_id }} |
| 226 | + TF_VAR_REGISTRY_CONTRACT_ADDRESS: ${{ inputs.registry_address }} |
| 227 | + TF_VAR_SLASH_FACTORY_CONTRACT_ADDRESS: ${{ inputs.slash_factory_address }} |
| 228 | + TF_VAR_FEE_ASSET_HANDLER_CONTRACT_ADDRESS: ${{ inputs.fee_asset_handler_address }} |
| 229 | + TF_VAR_VALIDATOR_MNEMONIC: ${{ inputs.validator_mnemonic }} |
| 230 | + TF_VAR_VALIDATOR_MNEMONIC_START_INDEX: ${{ inputs.validator_mnemonic_start_index }} |
| 231 | + TF_VAR_VALIDATORS_PER_NODE: ${{ inputs.validators_per_node }} |
| 232 | + TF_VAR_VALIDATOR_REPLICAS: ${{ inputs.validator_replicas }} |
| 233 | + TF_VAR_PROVER_MNEMONIC: ${{ inputs.prover_mnemonic }} |
| 234 | + TF_VAR_PROVER_MNEMONIC_START_INDEX: ${{ inputs.prover_mnemonic_start_index }} |
| 235 | + TF_VAR_P2P_BOOTSTRAP_RESOURCE_PROFILE: ${{ inputs.p2p_bootstrap_resource_profile }} |
| 236 | + TF_VAR_VALIDATOR_RESOURCE_PROFILE: ${{ inputs.validator_resource_profile }} |
| 237 | + TF_VAR_PROVER_RESOURCE_PROFILE: ${{ inputs.prover_resource_profile }} |
| 238 | + TF_VAR_RPC_RESOURCE_PROFILE: ${{ inputs.rpc_resource_profile }} |
| 239 | + TF_VAR_RPC_EXTERNAL_INGRESS: ${{ inputs.rpc_external_ingress }} |
| 240 | + |
| 241 | + steps: |
| 242 | + - name: Debug inputs |
| 243 | + run: | |
| 244 | + echo "cluster: ${{ inputs.cluster }}" |
| 245 | + echo "namespace: ${{ inputs.namespace }}" |
| 246 | +
|
| 247 | + - name: Setup K8s and Terraform |
| 248 | + uses: ./.github/actions/setup-k8s-terraform |
| 249 | + with: |
| 250 | + cluster: ${{ inputs.cluster }} |
| 251 | + namespace: ${{ inputs.namespace }} |
| 252 | + ref: ${{ inputs.ref || github.ref }} |
| 253 | + gcp_sa_key: ${{ secrets.GCP_SA_KEY }} |
| 254 | + kubeconfig_b64: ${{ secrets.KUBECONFIG_B64 }} |
| 255 | + terraform_dir: ./spartan/terraform/deploy-aztec-infra |
| 256 | + tf_state_prefix: deploy-aztec-infra |
| 257 | + run_terraform_destroy: ${{ inputs.run_terraform_destroy }} |
| 258 | + |
| 259 | + - name: Terraform Plan |
| 260 | + working-directory: ./spartan/terraform/deploy-aztec-infra |
| 261 | + run: | |
| 262 | + # All variables are now set as TF_VAR_ environment variables |
| 263 | + terraform plan -out=tfplan |
| 264 | +
|
| 265 | + - name: Terraform Apply |
| 266 | + working-directory: ./spartan/terraform/deploy-aztec-infra |
| 267 | + run: | |
| 268 | + terraform apply tfplan |
0 commit comments