Skip to content

Commit 233ebad

Browse files
roll back commands fix
1 parent e5dc378 commit 233ebad

2 files changed

Lines changed: 46 additions & 8 deletions

File tree

infra/scripts/deploy_to_azure.ps1

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -668,18 +668,37 @@ function Print-Summary {
668668

669669
Write-Host ""
670670
Write-Host " ┌─ Rollback Commands (if needed) ───────────────────────────────"
671+
Write-Host " │ NOTE: When rolling back to images from a different registry"
672+
Write-Host " │ (e.g. biabcontainerreg.azurecr.io public defaults), the Web App"
673+
Write-Host " │ also needs acrUseManagedIdentityCreds disabled and the"
674+
Write-Host " │ DOCKER_REGISTRY_SERVER_URL updated, otherwise the pull will"
675+
Write-Host " │ fail with ACRTokenRetrievalFailure. Container Apps fall back"
676+
Write-Host " │ to anonymous pull automatically for public registries."
677+
Write-Host " └──────────────────────────────────────────────────────────────"
678+
Write-Host ""
679+
Write-Host " Copy/paste the commands below (one per line):"
680+
Write-Host ""
671681

672682
if ($script:DeployBackend -and $script:BackendCA -and $script:OldBackendImage) {
673-
Write-Host " │ Backend: az containerapp update --name $($script:BackendCA) --resource-group $ResourceGroup --image $($script:OldBackendImage)"
683+
Write-Host " # Backend rollback"
684+
Write-Host " az containerapp update --name $($script:BackendCA) --resource-group $ResourceGroup --image $($script:OldBackendImage)"
685+
Write-Host ""
674686
}
675687
if ($script:DeployMcp -and $script:McpCA -and $script:OldMcpImage) {
676-
Write-Host " │ MCP: az containerapp update --name $($script:McpCA) --resource-group $ResourceGroup --image $($script:OldMcpImage)"
688+
Write-Host " # MCP rollback"
689+
Write-Host " az containerapp update --name $($script:McpCA) --resource-group $ResourceGroup --image $($script:OldMcpImage)"
690+
Write-Host ""
677691
}
678692
if ($script:DeployFrontend -and $script:FrontendApp -and $script:OldFrontendImage) {
679693
$oldImg = $script:OldFrontendImage -replace '^DOCKER\|', ''
680-
Write-Host " │ Frontend: az webapp config container set --name $($script:FrontendApp) --resource-group $ResourceGroup --container-image-name $oldImg"
694+
$oldRegistry = ($oldImg -split '/')[0]
695+
Write-Host " # Frontend rollback (run all 4 lines)"
696+
Write-Host " az webapp config set --name $($script:FrontendApp) --resource-group $ResourceGroup --generic-configurations '{\""acrUseManagedIdentityCreds\"": false}'"
697+
Write-Host " az webapp config appsettings set --name $($script:FrontendApp) --resource-group $ResourceGroup --settings DOCKER_REGISTRY_SERVER_URL=https://$oldRegistry"
698+
Write-Host " az webapp config container set --name $($script:FrontendApp) --resource-group $ResourceGroup --container-image-name $oldImg"
699+
Write-Host " az webapp restart --name $($script:FrontendApp) --resource-group $ResourceGroup"
700+
Write-Host ""
681701
}
682-
Write-Host " └──────────────────────────────────────────────────────────────"
683702

684703
if ($DryRun) {
685704
Write-Host ""

infra/scripts/deploy_to_azure.sh

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -822,18 +822,37 @@ print_summary() {
822822

823823
echo ""
824824
echo " ┌─ Rollback Commands (if needed) ───────────────────────────────"
825+
echo " │ NOTE: When rolling back to images from a different registry"
826+
echo " │ (e.g. biabcontainerreg.azurecr.io public defaults), the Web App"
827+
echo " │ also needs acrUseManagedIdentityCreds disabled and the"
828+
echo " │ DOCKER_REGISTRY_SERVER_URL updated, otherwise the pull will"
829+
echo " │ fail with ACRTokenRetrievalFailure. Container Apps fall back"
830+
echo " │ to anonymous pull automatically for public registries."
831+
echo " └──────────────────────────────────────────────────────────────"
832+
echo ""
833+
echo " Copy/paste the commands below (one per line):"
834+
echo ""
825835

826836
if [[ "$DEPLOY_BACKEND" == true && -n "$BACKEND_CA" && -n "${OLD_BACKEND_IMAGE:-}" ]]; then
827-
echo " │ Backend: az containerapp update --name $BACKEND_CA --resource-group $RESOURCE_GROUP --image $OLD_BACKEND_IMAGE"
837+
echo " # Backend rollback"
838+
echo " az containerapp update --name $BACKEND_CA --resource-group $RESOURCE_GROUP --image $OLD_BACKEND_IMAGE"
839+
echo ""
828840
fi
829841
if [[ "$DEPLOY_MCP" == true && -n "$MCP_CA" && -n "${OLD_MCP_IMAGE:-}" ]]; then
830-
echo " │ MCP: az containerapp update --name $MCP_CA --resource-group $RESOURCE_GROUP --image $OLD_MCP_IMAGE"
842+
echo " # MCP rollback"
843+
echo " az containerapp update --name $MCP_CA --resource-group $RESOURCE_GROUP --image $OLD_MCP_IMAGE"
844+
echo ""
831845
fi
832846
if [[ "$DEPLOY_FRONTEND" == true && -n "$FRONTEND_APP" && -n "${OLD_FRONTEND_IMAGE:-}" ]]; then
833847
local old_img="${OLD_FRONTEND_IMAGE#DOCKER|}"
834-
echo " │ Frontend: az webapp config container set --name $FRONTEND_APP --resource-group $RESOURCE_GROUP --container-image-name $old_img"
848+
local old_registry="${old_img%%/*}"
849+
echo " # Frontend rollback (run all 4 lines)"
850+
echo " az webapp config set --name $FRONTEND_APP --resource-group $RESOURCE_GROUP --generic-configurations '{\"acrUseManagedIdentityCreds\": false}'"
851+
echo " az webapp config appsettings set --name $FRONTEND_APP --resource-group $RESOURCE_GROUP --settings DOCKER_REGISTRY_SERVER_URL=https://$old_registry"
852+
echo " az webapp config container set --name $FRONTEND_APP --resource-group $RESOURCE_GROUP --container-image-name $old_img"
853+
echo " az webapp restart --name $FRONTEND_APP --resource-group $RESOURCE_GROUP"
854+
echo ""
835855
fi
836-
echo " └──────────────────────────────────────────────────────────────"
837856

838857
if [[ "$DRY_RUN" == true ]]; then
839858
echo ""

0 commit comments

Comments
 (0)