44
44
45
45
# ✅ Install Terraform
46
46
- name : Setup Terraform
47
- uses : hashicorp/setup-terraform@v2
48
- with :
49
- terraform_version : 1.6.6
47
+ uses : hashicorp/setup-terraform@v3
50
48
51
49
# ✅ Terraform Init & Workspace
52
50
- name : Terraform Init & Workspace
@@ -63,16 +61,20 @@ jobs:
63
61
-var "stage=${{ github.event.inputs.stage }}"
64
62
65
63
# ✅ Get EC2 IPs & S3 Bucket
66
- - name : Get EC2 Public IP & S3 Bucket Name
64
+ - name : Get EC2s Public IPs & S3 Bucket Name
67
65
working-directory : ${{ env.TF_WORKING_DIR }}
68
66
run : |
69
- APP_IP =$(terraform output -raw instance_public_ip | grep -oE '([0-9]{1,3}\.){3}[0-9]{1,3}' | head -n1)
70
- VERIFIER_IP=$(terraform output -raw verifier_instance_public_ip | grep -oE '([0-9]{1,3}\.){3}[0-9]{1,3}' | head -n1)
71
- S3_BUCKET=$(terraform output -raw s3_log_bucket | grep -oE 'techeazy-logs-[^[:space:]]+' | head -n1)
67
+ echo "INSTANCE_IP =$(terraform output -raw instance_public_ip)" >> $GITHUB_ENV
68
+ echo " VERIFIER_IP=$(terraform output -raw verifier_instance_public_ip)" >> $GITHUB_ENV
69
+ echo " S3_BUCKET=$(terraform output -raw s3_log_bucket)" >> $GITHUB_ENV
72
70
73
- echo "📦 App IP: $APP_IP "
71
+ echo "📦 App IP: $INSTANCE_IP "
74
72
echo "🔑 Verifier IP: $VERIFIER_IP"
75
73
echo "🪣 S3 Bucket: $S3_BUCKET"
74
+ echo "📦 App IP: ${{ env.INSTANCE_IP }}"
75
+ echo "🔑 Verifier IP: ${{ env.VERIFIER_IP }}"
76
+ echo "🪣 S3 Bucket: ${{ env.S3_BUCKET }}"
77
+
76
78
77
79
# ✅ Wait for App Initialization
78
80
- name : Wait for App Initialization
83
85
# ✅ Validate App Health
84
86
- name : Validate App Health
85
87
run : |
86
- echo "🌐 Checking app health at http://$APP_IP :80"
88
+ echo "🌐 Checking app health at http://${{ env.INSTANCE_IP }} :80"
87
89
for i in {1..10}; do
88
- STATUS=$(curl -o /dev/null -s -w "%{http_code}" http://$APP_IP :80)
90
+ STATUS=$(curl -o /dev/null -s -w "%{http_code}" http://$INSTANCE_IP :80)
89
91
if [[ "$STATUS" == "200" ]]; then
90
92
echo "✅ App is healthy (HTTP 200)"
91
93
exit 0
0 commit comments