Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update deploy.sh #88

Merged
merged 3 commits into from
Jul 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions infra/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -509,21 +509,22 @@ grantDevAccessToAzureResources() {

createAcrIfNotExists() {
# check if container registry exists
if [ ! -z "$CONTAINER_REGISTRY_SERVER" ]; then
printf "Checking if container registry '$CONTAINER_REGISTRY_SERVER' exists... "
az acr show --name $CONTAINER_REGISTRY_SERVER > /dev/null 2>&1
exitIfCommandFailed $? "Container registry '$CONTAINER_REGISTRY_SERVER' not found, exiting..."
printf "Yes.\n"
printf "Checking if container registry exists... "
local existingRegistry
existingRegistry=$(az acr show --name $CONTAINER_REGISTRY_SERVER --query loginServer -o tsv 2>/dev/null)
if [ $? -eq 0 ]; then
printf "Yes.\nUsing existing registry '$existingRegistry'.\n"
CONTAINER_REGISTRY_SERVER=$existingRegistry
return 0
fi
# else deploy a new container registry
printf "Creating container registry... "
printf "No.\nCreating container registry... "
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 \
--parameters "name=$CONTAINER_REGISTRY_SERVER")
exitIfCommandFailed $? "Error creating container registry, exiting..."
CONTAINER_REGISTRY_SERVER=$(jq -r .properties.outputs.loginServer.value <<< $AZURE_ACR_DEPLOY_RESULT)
exitIfValueEmpty "$CONTAINER_REGISTRY_SERVER" "Unable to parse container registry login server from deployment, exiting..."
printf "container registry '$CONTAINER_REGISTRY_SERVER' created.\n"
printf "'$CONTAINER_REGISTRY_SERVER' created.\n"
}

deployDockerImageToACR() {
Expand Down
Loading