You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
az aks operation-abort --resource-group "$RG" --name "$AKS" --operation-id "$OP_ID" || echo "⚠️ Could not abort operation, may require manual intervention"
124
+
done
125
+
126
+
# Wait for all operations to complete or be aborted
127
+
echo "⏳ Waiting for operations to complete or be aborted..."
128
+
max_retries=20
129
+
retry_count=0
130
+
while [ $retry_count -lt $max_retries ]; do
131
+
ONGOING_COUNT=$(az aks operation list --resource-group "$RG" --name "$AKS" --query "length([?status=='Running' || status=='Pending'])" -o tsv)
132
+
if [ "$ONGOING_COUNT" -eq 0 ]; then
133
+
echo "✅ No more ongoing operations"
134
+
break
135
+
fi
136
+
echo "⏳ Still have $ONGOING_COUNT ongoing operations, waiting 15s... ($(($retry_count + 1))/$max_retries)"
137
+
sleep 15
138
+
retry_count=$((retry_count + 1))
139
+
done
140
+
141
+
if [ $retry_count -eq $max_retries ]; then
142
+
echo "::warning::Timed out waiting for operations to complete. This might cause Terraform to fail."
143
+
fi
144
+
else
145
+
echo "✅ No ongoing operations found"
146
+
fi
147
+
148
+
# Wait for the cluster to be in a Succeeded provisioning state
149
+
echo "⏳ Ensuring cluster is in a Succeeded state..."
117
150
max_retries=10
118
151
retry_count=0
119
152
while [ $retry_count -lt $max_retries ]; do
120
-
if az aks show --resource-group "$RG" --name "$AKS" --query "provisioningState" -o tsv | grep -q "Succeeded"; then
121
-
echo "✅ AKS reconciliation completed successfully"
153
+
PROVISION_STATE=$(az aks show --resource-group "$RG" --name "$AKS" --query "provisioningState" -o tsv)
154
+
if [ "$PROVISION_STATE" = "Succeeded" ]; then
155
+
echo "✅ AKS cluster is in Succeeded state"
122
156
break
123
157
fi
124
-
echo "⏳ AKS still reconciling, waiting 30s... ($(($retry_count + 1))/$max_retries)"
158
+
echo "⏳ AKS state: $PROVISION_STATE, waiting 30s... ($(($retry_count + 1))/$max_retries)"
125
159
sleep 30
126
160
retry_count=$((retry_count + 1))
127
161
done
128
162
129
163
if [ $retry_count -eq $max_retries ]; then
130
-
echo "⚠️ AKS reconciliation timed out but continuing with deployment"
164
+
echo "::warning::Timed out waiting for AKS to reach Succeeded state. This might cause Terraform to fail."
0 commit comments