问题
In VSTS Release, how do I stop all continuous webjobs and remove schedule from triggered webjobs for specific deployment slot?
scenario:
I have a asp.net core web application with bunch of webjobs. Some of them are scheduled, some are continuous.
In VSTS Release I deploy the webjobs together with web app to App Service using Web Deploy.
However, in staging environment I don't want to run the webjobs, since they would interfere with production (the share the same database, etc).
I guess I would have to write some powershell to stop the webjobs. It comes down to these steps:
- How do I run PowerShell in VSTS that is connected to my Azure Subscription
- How do I list all webjobs for my webapp and deployment slot
- How do I stop continuous webjob
- How do I set trigger to manual and remove schedule from scheduled webjobs
回答1:
You can set two sticky app settings on the staging slot:
- WEBJOBS_STOPPED: 1
- WEBJOBS_DISABLE_SCHEDULE: 1
Actually not sure if you need the second one even. Source: Kudu Wiki
Then WebJobs will not run on that slot, and by setting the slots sticky (i.e. slot settings), they will stay on the staging slot and not be swapped with the app.
来源:https://stackoverflow.com/questions/50719134/how-to-stop-continuous-and-remove-schedule-from-schedules-web-jobs-in-vsts