简体   繁体   English

Azure DevOps - 应用服务 - 并行插槽交换

[英]Azure DevOps - App Service - Parallel Slot Swap

This Deploy Task is super cool. 这个部署任务非常酷。 I want to do two at once. 我想一次做两个。 Is there a way to do this via DevOps tasks? 有没有办法通过DevOps任务执行此操作? If not are there any know work-arounds? 如果没有,是否有任何已知的解决方法? I tried this with Azure PowerShell but the commands didn't fire, even though it works locally :( 我尝试使用Azure PowerShell,但命令没有触发,即使它在本地工作:(

Start-Job -Name API {
    #Switch-AzureRmWebAppSlot -SourceSlotName "staging" -DestinationSlotName "production" -ResourceGroupName "CoolResGroup" -Name "something-api-east"
}

Write-Host "API Staging <-> Prod swap initiated"

Start-Job -Name Web {
    #Switch-AzureRmWebAppSlot -SourceSlotName "staging" -DestinationSlotName "production" -ResourceGroupName "CoolResGroup" -Name "something-web-east"
}

Write-Host "Web Staging <-> Prod swap initiated"

Wait-Job -Name API
Wait-Job -Name Web

If (Get-Job -Name API -ea silentlycontinue)
{
    Write-Host "API state: $((Get-Job -Name API).State)"
} 
Else 
{
    Write-Host "API slot swap complete."
}

If (Get-Job -Name Web -ea silentlycontinue)
{
    Write-Host "Web state: $((Get-Job -Name Web).State)"
} 
Else 
{
    Write-Host "Web slot swap complete."
}

By default those powershell cmdlets are blocking, so you either need to start them in a background thread, or convert them to API calls (they shouldn't be blocking). 默认情况下,那些powershell cmdlet是阻塞的,因此您需要在后台线程中启动它们,或者将它们转换为API调用(它们不应该阻塞)。 This way you can perform those 2 calls more or less at the same time. 这样,您可以同时或多或少地执行这两个呼叫。

This would, however, complicate your flow, as you'd need to detect if both swaps completed fine (so an extra check you'd need to make). 但是,这会使您的流量变得复杂,因为您需要检测两个掉期是否完成(因此需要额外检查)。

Alternatively you are better of using A\\B deployments. 或者,您最好使用A \\ B部署。 Links: https://www.hanselman.com/blog/ABTestingAndTestingInProductionWithAzureWebApps.aspx 链接: https//www.hanselman.com/blog/ABTestingAndTestingInProductionWithAzureWebApps.aspx
http://involvenevolve.com/post/managing-azure-app-service-routing-rules/ http://involvenevolve.com/post/managing-azure-app-service-routing-rules/
https://docs.microsoft.com/ru-ru/cli/azure/webapp/traffic-routing?view=azure-cli-latest#az-webapp-traffic-routing-set https://docs.microsoft.com/ru-ru/cli/azure/webapp/traffic-routing?view=azure-cli-latest#az-webapp-traffic-routing-set

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 强制停止 Azure 应用服务部署插槽交换 - Force stop Azure App Service Deployment Slot Swap Azure DevOps 发布管道消除了应用服务部署槽 - Azure DevOps Release Pipeline wipes out App Service Deployment Slot Azure Devops 中的交换服务结构 - swap service fabric in Azure Devops 用于并行应用部署的 Azure DevOps 审批门 - Azure DevOps Approval Gate For Parallel App Deployments 在 Azure devops (angular+api) 中交换插槽,如何更改目标插槽的 Angular 配置? - Swap slots in Azure devops (angular+api), how to change Angular configuration for the target slot? 如何在 Azure DevOps 上的发布管道中添加插槽交换任务之前的批准 - How to add Approval before Slot Swap task in Release pipeline on Azure DevOps 从Azure DevOps部署到App Service环境 - Deploying to App Service Environment from Azure DevOps DevOps 和 Azure 应用服务中的环境变量 - Environment Variables in DevOps and Azure App Service 在Azure App Service Deploy中查找Azure插槽位置 - Find Azure slot location in azure App Service Deploy 在 Azure DevOps 上为 Service Fabric 应用程序构建管道 - Build pipeline for service fabric app on Azure devops
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM