Skip to content

Commit 3f69b91

Browse files
update scripts
1 parent 98dac8c commit 3f69b91

2 files changed

Lines changed: 0 additions & 109 deletions

File tree

infra/scripts/acr_build_push.ps1

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -83,45 +83,6 @@ else {
8383
}
8484

8585
$IMAGE_TAG = "latest"
86-
87-
# Detect whether this is a WAF deployment
88-
$DeploymentType = az group show `
89-
--name $RESOURCE_GROUP `
90-
--query "tags.Type" `
91-
-o tsv
92-
93-
$IsWAF = $DeploymentType -eq "WAF"
94-
95-
$OriginalPublicNetworkAccess = $null
96-
97-
if ($IsWAF) {
98-
99-
Write-Host ""
100-
Write-Host "WAF deployment detected."
101-
102-
# Save current setting
103-
$OriginalPublicNetworkAccess = az acr show `
104-
--name $ACR_NAME `
105-
--resource-group $RESOURCE_GROUP `
106-
--query "publicNetworkAccess" `
107-
-o tsv
108-
109-
if ($OriginalPublicNetworkAccess -eq "Disabled") {
110-
111-
Write-Host "Temporarily enabling ACR Public Network Access..."
112-
113-
az acr update `
114-
--name $ACR_NAME `
115-
--resource-group $RESOURCE_GROUP `
116-
--public-network-enabled true
117-
118-
if ($LASTEXITCODE -ne 0) {
119-
throw "Failed to enable ACR Public Network Access."
120-
}
121-
122-
Start-Sleep -Seconds 20
123-
}
124-
}
12586

12687
# Get the script directory and navigate to repo root
12788
$ScriptDir = $PSScriptRoot
@@ -134,7 +95,6 @@ Write-Host " Resource Group: $RESOURCE_GROUP"
13495
Write-Host " Image Tag: $IMAGE_TAG"
13596
Write-Host ""
13697

137-
try {
13898
# =============================================================================
13999
# Step 1: Build and push images to ACR using az acr build
140100
# =============================================================================
@@ -254,25 +214,3 @@ try {
254214
Write-Host "============================================================"
255215
Write-Host "ACR Build and Push - Completed Successfully!"
256216
Write-Host "============================================================"
257-
258-
}
259-
finally {
260-
261-
if ($IsWAF -and $OriginalPublicNetworkAccess -eq "Disabled") {
262-
263-
Write-Host ""
264-
Write-Host "Restoring ACR Public Network Access..."
265-
266-
az acr update `
267-
--name $ACR_NAME `
268-
--resource-group $RESOURCE_GROUP `
269-
--public-network-enabled false
270-
271-
if ($LASTEXITCODE -eq 0) {
272-
Write-Host "ACR Public Network Access restored."
273-
}
274-
else {
275-
Write-Warning "Failed to restore ACR Public Network Access."
276-
}
277-
}
278-
}

infra/scripts/acr_build_push.sh

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -82,35 +82,6 @@ DEPLOYMENT_TYPE=$(az group show \
8282
--query "tags.Type" \
8383
-o tsv)
8484

85-
IS_WAF=false
86-
87-
if [ "$DEPLOYMENT_TYPE" = "WAF" ]; then
88-
IS_WAF=true
89-
fi
90-
91-
ORIGINAL_PUBLIC_ACCESS=""
92-
93-
if [ "$IS_WAF" = true ]; then
94-
95-
ORIGINAL_PUBLIC_ACCESS=$(az acr show \
96-
--name "$ACR_NAME" \
97-
--resource-group "$RESOURCE_GROUP" \
98-
--query publicNetworkAccess \
99-
-o tsv)
100-
101-
if [ "$ORIGINAL_PUBLIC_ACCESS" = "Disabled" ]; then
102-
103-
echo ""
104-
echo "Temporarily enabling ACR Public Network Access..."
105-
106-
az acr update \
107-
--name "$ACR_NAME" \
108-
--resource-group "$RESOURCE_GROUP" \
109-
--public-network-enabled true
110-
111-
sleep 20
112-
fi
113-
fi
11485

11586
# Get the directory where this script is located
11687
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
@@ -124,24 +95,6 @@ echo " Resource Group: $RESOURCE_GROUP"
12495
echo " Image Tag: $IMAGE_TAG"
12596
echo ""
12697

127-
cleanup() {
128-
129-
if [ "$IS_WAF" = true ] && [ "$ORIGINAL_PUBLIC_ACCESS" = "Disabled" ]; then
130-
131-
echo ""
132-
echo "Restoring ACR Public Network Access..."
133-
134-
az acr update \
135-
--name "$ACR_NAME" \
136-
--resource-group "$RESOURCE_GROUP" \
137-
--public-network-enabled false
138-
139-
echo "ACR Public Network Access restored."
140-
141-
fi
142-
}
143-
144-
trap cleanup EXIT
14598
# =============================================================================
14699
# Step 1: Build and push images to ACR using az acr build
147100
# =============================================================================

0 commit comments

Comments
 (0)