Skip to content

Commit 14ff0fc

Browse files
committed
refactor(spartan): unify deployment config sources
1 parent de7fcc2 commit 14ff0fc

71 files changed

Lines changed: 2160 additions & 2108 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/deploy-network.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,10 @@ jobs:
112112

113113
- name: Validate inputs
114114
run: |
115-
# Validate network
116-
if [[ ! -f "spartan/environments/${{ inputs.network }}.env" ]]; then
117-
echo "Error: Environment file not found for network '${{ inputs.network }}'"
115+
if [[ ! -f "spartan/environments/networks/${{ inputs.network }}.yml" ]]; then
116+
echo "Error: Network YAML not found: spartan/environments/networks/${{ inputs.network }}.yml"
118117
echo "Available networks:"
119-
ls -1 spartan/environments/ | grep -v '\.local\.env$' || echo "No environment files found"
118+
ls -1 spartan/environments/networks/
120119
exit 1
121120
fi
122121
@@ -191,8 +190,9 @@ jobs:
191190
./scripts/install_deps.sh
192191
./scripts/network_deploy.sh "${{ inputs.network }}"
193192
194-
# need to source this for CLUSTER
195-
source "./environments/${{ inputs.network }}.env"
193+
# Source for CLUSTER (prefers YAML loader, falls back to legacy .env).
194+
source "./scripts/source_env_basic.sh"
195+
source_env_basic "${{ inputs.network }}"
196196
197197
if [ -n "$CLUSTER" ]; then
198198
echo "cluster=$CLUSTER" >> $GITHUB_OUTPUT

.github/workflows/ensure-funded-environment.yml

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,54 +6,54 @@ on:
66
workflow_call:
77
inputs:
88
environment:
9-
description: 'Environment to fund (e.g., staging-public, next-net, staging-ignition, testnet)'
9+
description: "Environment to fund (e.g., staging-public, next-net, staging-ignition, testnet)"
1010
required: true
1111
type: string
1212
low_watermark:
13-
description: 'Minimum ETH balance (default: 0.5)'
13+
description: "Minimum ETH balance (default: 0.5)"
1414
required: false
1515
type: string
16-
default: '0.5'
16+
default: "0.5"
1717
high_watermark:
18-
description: 'Target ETH balance when funding (default: 1.0)'
18+
description: "Target ETH balance when funding (default: 1.0)"
1919
required: false
2020
type: string
21-
default: '1.0'
21+
default: "1.0"
2222
namespace:
23-
description: 'Kubernetes namespace override (e.g., v4-devnet-1). Sets NAMESPACE before sourcing env file.'
23+
description: "Kubernetes namespace override (e.g., v4-devnet-1). Sets NAMESPACE before sourcing env file."
2424
required: false
2525
type: string
2626
workflow_dispatch:
2727
inputs:
2828
environment:
29-
description: 'Environment to fund'
29+
description: "Environment to fund"
3030
required: true
3131
type: choice
3232
options:
33-
- staging-public
34-
- next-net
35-
- staging-ignition
36-
- testnet
37-
- devnet
38-
- tps-scenario
33+
- staging-public
34+
- next-net
35+
- staging-ignition
36+
- testnet
37+
- devnet
38+
- tps-scenario
3939
low_watermark:
40-
description: 'Minimum ETH balance'
40+
description: "Minimum ETH balance"
4141
required: false
4242
type: string
43-
default: '0.5'
43+
default: "0.5"
4444
high_watermark:
45-
description: 'Target ETH balance when funding'
45+
description: "Target ETH balance when funding"
4646
required: false
4747
type: string
48-
default: '1.0'
48+
default: "1.0"
4949
namespace:
50-
description: 'Kubernetes namespace override (e.g., v4-devnet-1)'
50+
description: "Kubernetes namespace override (e.g., v4-devnet-1)"
5151
required: false
5252
type: string
5353

5454
concurrency:
5555
group: ensure-funded-environment-${{ inputs.environment }}
56-
cancel-in-progress: false # Don't cancel funding operations
56+
cancel-in-progress: false # Don't cancel funding operations
5757

5858
jobs:
5959
ensure-funded:
@@ -71,10 +71,10 @@ jobs:
7171
- name: Validate inputs
7272
run: |
7373
# Validate environment
74-
if [[ ! -f "spartan/environments/${{ inputs.environment }}.env" ]]; then
75-
echo "Error: Environment file not found for environment '${{ inputs.environment }}'"
74+
if [[ ! -f "spartan/environments/networks/${{ inputs.environment }}.yml" ]]; then
75+
echo "Error: Network YAML not found: spartan/environments/networks/${{ inputs.environment }}.yml"
7676
echo "Available environments:"
77-
ls -1 spartan/environments/ | grep -v '\.local\.env$' || echo "No environment files found"
77+
ls -1 spartan/environments/networks/
7878
exit 1
7979
fi
8080

l1-contracts/scripts/load_network_defaults.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ fi
2020

2121
# explode(.) resolves YAML anchors (<<: *prodlike inheritance)
2222
# Output as props, filter comments, normalize spacing
23+
# Read from .networks.<name>.env (flat env baseline; was .networks.<name> pre-refactor).
2324
while IFS='=' read -r key value; do
2425
export "$key"="$value"
25-
done < <(yq -o=props "explode(.) | .networks.$network | with_entries(select(.key | test(\"^AZTEC_|^ETHEREUM_\")))" "$network_defaults" \
26+
done < <(yq -o=props "explode(.) | .networks.$network.env | with_entries(select(.key | test(\"^AZTEC_|^ETHEREUM_\")))" "$network_defaults" \
2627
| grep -v '^#' \
2728
| grep -v '^$' \
2829
| sed 's/ = /=/')

spartan/.gitignore

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,7 @@ tfplan
99
mnemonic.tmp
1010
environments/*
1111
!environments/network-defaults.yml
12-
!environments/prove-n-tps-fake.env
13-
!environments/prove-n-tps-real.env
14-
!environments/ten-tps-short-epoch.env
15-
!environments/ten-tps-long-epoch.env
16-
!environments/five-tps-short-epoch.env
17-
!environments/five-tps-long-epoch.env
18-
!environments/devnet-next.env
19-
!environments/devnet.env
20-
!environments/block-capacity.env
21-
!environments/next-net.env
22-
!environments/next-scenario.env
23-
!environments/scenario.local.env
24-
!environments/source-env.sh
25-
!environments/staging-ignition.env
26-
!environments/staging-public.env
27-
!environments/staging.local.env
28-
!environments/testnet-canary.env
29-
!environments/testnet.env
30-
!environments/mainnet.env
31-
!environments/tps-scenario.env
32-
!environments/kind-minimal.env
33-
!environments/kind-provers.env
34-
!environments/alpha-net.env
35-
!environments/mbps-pipeline.env
12+
!environments/networks/
13+
!environments/networks/*.yml
3614
*.tfvars
3715
!terraform/deploy-external-secrets/*.tfvars

0 commit comments

Comments
 (0)