【发布时间】:2022-01-02 03:57:53
【问题描述】:
在我对包含 2 个插槽(production 和 staging 插槽)的 App Service 资源进行的一些部署中,在交换插槽后,暂存网络作业不会停止。
基本上我的管道中有以下任务:
## Start App Service (staging)
- task: AzureAppServiceManage@0
displayName: 'Start Azure App Service: some-app-webjob (staging)'
inputs:
azureSubscription: 'xxx'
Action: 'Start Azure App Service'
WebAppName: 'some-app-webjob'
SpecifySlotOrASE: true
ResourceGroupName: 'some-rg-app-webjob'
Slot: staging
##Start staging continuous webjob
- task: AzureAppServiceManage@0
displayName: 'Start all continuous webjobs: some-app-webjob (staging)'
inputs:
azureSubscription: 'Subscrição do Visual Studio Enterprise(c9f20c2b-15cf-41fb-8122-ddf095c6db02)'
Action: 'Start all continuous webjobs'
WebAppName: 'some-app-webjob'
SpecifySlotOrASE: true
ResourceGroupName: 'some-rg-app-webjob'
Slot: 'staging'
## Swap Slots (staging to production)
- task: AzureAppServiceManage@0
displayName: 'Swap Slots: some-app-webjob'
inputs:
azureSubscription: 'xxx'
WebAppName: 'some-app-webjob'
ResourceGroupName: 'some-rg-app-webjob'
SourceSlot: staging
TargetSlot: production
# Stop WebJobs running Staging
- task: AzureAppServiceManage@0
displayName: 'Stop all continuous webjobs: some-app-webjob (staging)'
inputs:
azureSubscription: 'xxx'
Action: 'Stop all continuous webjobs'
WebAppName: 'some-app-webjob'
SpecifySlotOrASE: true
ResourceGroupName: 'some-rg-app-webjob'
Slot: staging
## Stop App Service (staging)
- task: AzureAppServiceManage@0
displayName: 'Stop Azure App Service: some-app-webjob (staging)'
inputs:
azureSubscription: 'xxx'
Action: 'Stop Azure App Service'
WebAppName: 'some-app-webjob'
SpecifySlotOrASE: true
ResourceGroupName: 'some-rg-app-webjob'
Slot: staging
如果我查看我的插槽暂存应用程序服务将停止。但有时工作作业会继续运行,而它不应该运行。因为我有一项任务应该在与生产交换后的所有连续网络作业中排在首位。
总而言之,这可能会发生:
- 插槽分段运行中的连续 Web 作业
- 插槽生产运行中的连续网络作业
经过搜索,我找到了这个 github 线程 https://github.com/projectkudu/kudu/issues/1886 它表示 webjobs 正在 scm 站点中运行,不受停止站点命令的影响。 不过,我有一个任务据说会停止所有连续的网络作业。
发生这种情况有什么原因吗?我们怎样才能防止这种情况发生? 我不希望在部署后运行旧代码的网络作业。
【问题讨论】:
标签: azure azure-devops azure-web-app-service azure-webjobs webjob