1
votes

We are using Azure DevOps to deploy to a staging slot and then swap with production. When there is an issue swapping it will keep trying for nearly 30 minutes.

Therefore I would like to put a timeout on the swap task, but if I do that it will stop the task in DevOps and leave the process happening in Azure.

I would like a way to force stop the process through a CLI, API, PowerShell or DevOps task.

Azure CLI doesn't seem to have anything Kudu API can delete deployments but doesn't look to stop them (https://github.com/projectkudu/kudu/wiki/REST-API#deployment)

I have read that you can stop a process, but using a Linux Container App Service, I can't see that option. Azure-Web-sites: How to cancel a deployment?

Is there a way?

2
Can the solution in this ticket solve your issue?Walter
@WalterQian-MSFT I do not think it will as it would be restricted to the Start/Stop etc commands, which when running the Stop I get an error that an operation is still in progress. Further to that the Stop command stops the slot, which I don't want to do. I just want to force cancel the deployment.Chris Pateman

2 Answers

0
votes

Update

If any errors occur in the target slot (for example, the production slot) after a slot swap, restore the slots to their pre-swap states by swapping the same two slots immediately.

enter image description here

So, we don't need to stop it, just wait swap operation succeed.

When you submit swap slot request, you will get HttpStatus 202 code. On portal, when you click swap button, you will find that the browser has been requesting the url of location to get the status of swap.

As for when it ends, we can check the swap operation by polling.

If the swap operation time is too long, it is recommended to raise a support ticket and ask the engineer to check the reason.

Privious

You can use AzureAppServiceManage task.

Azure App Service Manage task

Use this task to start, stop, restart, slot swap, Swap with Preview, install site extensions, or enable continuous monitoring for an Azure App Service.

Tips

When you use rest api to swap slot, you can check location in response header.

enter image description here

When you submit swap slot request, you will get HttpStatus 202 code. On portal, when you click swap button, you will find that the browser has been requesting the url of location to get the status of swap.

0
votes

Please try to use the following command in Azure PowerShell task to cancel a pending swap:

Invoke-AzResourceAction -ResourceGroupName [resource group name] -ResourceType Microsoft.Web/sites/slots -ResourceName [app name]/[slot name] -Action resetSlotConfig -ApiVersion 2015-07-01

Here is the document and my sample, I added -Force -Confirm:$false at the end of the command: enter image description here