Skip to content
This repository was archived by the owner on May 27, 2025. It is now read-only.

Commit 106f123

Browse files
Update deploy.sh (#88)
Co-authored-by: Josh Bradley <[email protected]>
1 parent 07e8a6f commit 106f123

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

infra/deploy.sh

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -509,21 +509,22 @@ grantDevAccessToAzureResources() {
509509

510510
createAcrIfNotExists() {
511511
# check if container registry exists
512-
if [ ! -z "$CONTAINER_REGISTRY_SERVER" ]; then
513-
printf "Checking if container registry '$CONTAINER_REGISTRY_SERVER' exists... "
514-
az acr show --name $CONTAINER_REGISTRY_SERVER > /dev/null 2>&1
515-
exitIfCommandFailed $? "Container registry '$CONTAINER_REGISTRY_SERVER' not found, exiting..."
516-
printf "Yes.\n"
512+
printf "Checking if container registry exists... "
513+
local existingRegistry
514+
existingRegistry=$(az acr show --name $CONTAINER_REGISTRY_SERVER --query loginServer -o tsv 2>/dev/null)
515+
if [ $? -eq 0 ]; then
516+
printf "Yes.\nUsing existing registry '$existingRegistry'.\n"
517+
CONTAINER_REGISTRY_SERVER=$existingRegistry
517518
return 0
518519
fi
519520
# else deploy a new container registry
520-
printf "Creating container registry... "
521+
printf "No.\nCreating container registry... "
521522
AZURE_ACR_DEPLOY_RESULT=$(az deployment group create --resource-group $RESOURCE_GROUP --name "acr-deployment" --template-file core/acr/acr.bicep --only-show-errors --no-prompt -o json \
522523
--parameters "name=$CONTAINER_REGISTRY_SERVER")
523524
exitIfCommandFailed $? "Error creating container registry, exiting..."
524525
CONTAINER_REGISTRY_SERVER=$(jq -r .properties.outputs.loginServer.value <<< $AZURE_ACR_DEPLOY_RESULT)
525526
exitIfValueEmpty "$CONTAINER_REGISTRY_SERVER" "Unable to parse container registry login server from deployment, exiting..."
526-
printf "container registry '$CONTAINER_REGISTRY_SERVER' created.\n"
527+
printf "'$CONTAINER_REGISTRY_SERVER' created.\n"
527528
}
528529

529530
deployDockerImageToACR() {

0 commit comments

Comments
 (0)