问题
I have an Azure Function App / Azure Website setup with continuous deployment from source-control.
This App has a custom deployment script that takes quite a bit of time to run. Occasionally I push out a change to git which was a mistake, and I want to cancel that one deployment (While still allowing future git pushes to cause a deployment).
Is there a PowerShell command I can run, or some option which will cancel my current deployment?
回答1:
I was able to figure this out eventually, and figured I'd post it here. There is no "clean" way to do this, but there is a "hack".
Navigate to your SCM site:
[YOUR_WEBSITE].scm.azurewebsites.net
Click on "Process Explorer"
Find the process which is the current deployment and choose "Properties".
Scroll to the bottom of the page and choose "Kill"
Voilà, you've killed your deployment in the middle.
回答2:
There's nothing simple as far as I know.
It's possible that deleting the deployment via kudu rest apis (https://github.com/projectkudu/kudu/wiki/REST-API#deployment) would achieve what you want, but I expect that that will fail during deployment / only delete metadata and logs about the deployment.
Also, cancelling a deployment could leave unwanted artifacts in the filesystem / corrupt your web app. It's probably best to modify your deployments so that you have a development branch and a release branch in order to set up a more robust CI scenario.
来源:https://stackoverflow.com/questions/41965933/azure-web-sites-how-to-cancel-a-deployment