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() {
509
509
510
510
createAcrIfNotExists () {
511
511
# 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
517
518
return 0
518
519
fi
519
520
# else deploy a new container registry
520
- printf " Creating container registry... "
521
+ printf " No.\nCreating container registry... "
521
522
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 \
522
523
--parameters " name=$CONTAINER_REGISTRY_SERVER " )
523
524
exitIfCommandFailed $? " Error creating container registry, exiting..."
524
525
CONTAINER_REGISTRY_SERVER=$( jq -r .properties.outputs.loginServer.value <<< $AZURE_ACR_DEPLOY_RESULT )
525
526
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"
527
528
}
528
529
529
530
deployDockerImageToACR () {
You can’t perform that action at this time.
0 commit comments