Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 1c49686

Browse files
committedDec 11, 2023
Retry making ACR instance
1 parent 69034fc commit 1c49686

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed
 

‎deploy/k8s/create-acr.sh

+15-3
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,21 @@ then
9797
echo
9898
fi
9999

100-
eshopRegistry=`az acr show -n $eshopAcrName --query "loginServer" -otsv`
101100

102-
if [ -z "$eshopRegistry" ]
103-
then
101+
echo "Giving AKS access to ACR instance \"$eshopAcrName\"..."
102+
retryCount=0
103+
eshopRegistry=""
104+
105+
while [ -z "$eshopRegistry" ] && [ $retryCount -lt 10 ]; do
106+
eshopRegistry=$(az acr show -n $eshopAcrName --query "loginServer" -otsv)
107+
if [ -z "$eshopRegistry" ]; then
108+
echo "ACR instance wasn't ready. If this takes more than a minute or two, something is probably wrong. Trying again in 5 seconds..."
109+
sleep 5
110+
retryCount=$((retryCount+1))
111+
fi
112+
done
113+
114+
if [ -z "$eshopRegistry" ]; then
104115
echo "${newline}${errorStyle}ERROR! ACR server $eshopAcrName doesn't exist!${defaultTextStyle}${newline}"
105116
exit 1
106117
fi
@@ -119,6 +130,7 @@ then
119130
az role assignment create \
120131
--role AcrPull \
121132
--assignee-object-id $aksIdentityObjectId \
133+
--assignee-principal-type ServicePrincipal \
122134
--scope $acrResourceId \
123135
--output none
124136
fi

0 commit comments

Comments
 (0)
Please sign in to comment.