This repository was archived by the owner on May 27, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -509,21 +509,22 @@ grantDevAccessToAzureResources() {
509509
510510createAcrIfNotExists () {
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
529530deployDockerImageToACR () {
You can’t perform that action at this time.
0 commit comments