Skip to content

Commit c6b7299

Browse files
xiuwangXiuwang
andauthored
OCPQE-28378: Retry when create vpc in ibmcloud fails (#61548)
* Retry when create vpc in ibmcloud fails * Address echo comments --------- Co-authored-by: Xiuwang <[email protected]>
1 parent f0a8dbc commit c6b7299

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

ci-operator/step-registry/hypershift/mce/ibmz/create/zvsicompute/hypershift-mce-ibmz-create-zvsicompute-commands.sh

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,23 @@ fi
7272

7373
# Create VPC
7474
echo "Creating a VPC in the resource group $infra_name-rg"
75-
ibmcloud is vpc-create $infra_name-vpc --resource-group-name $infra_name-rg
75+
count=0
76+
max_retries=6
77+
sleeptime=30
78+
while [ $count -lt $max_retries ]; do
79+
count=$(( count + 1 ))
80+
echo "Try $count/6: Waiting for VPC to be successfully created ..."
81+
ibmcloud is vpc-create $infra_name-vpc --resource-group-name $infra_name-rg
82+
create_status=$?
83+
if [ $create_status -eq 0 ]; then
84+
echo "VPC $infra_name-vpc is created successfully"
85+
break
86+
else
87+
echo "Failed to create VPC after $count/6 retry, the error code is $create_status"
88+
sleep $sleeptime
89+
fi
90+
done
91+
7692
set +e
7793
vpc_status=$(ibmcloud is vpc $infra_name-vpc | awk '/Status/{print $2}')
7894
if [ "$vpc_status" != "available" ]; then

0 commit comments

Comments
 (0)