3

I have a release pipeline that runs Azure App Service deploy task and then runs API management update task from "API Management Suite" by Stephane Eyskens.

The API management task calls Swagger endpoint to update OpenAPI schema in the API management.

The problem is that App Service deploy task is lying - the app is not ready right after deployment. It still runs the old version and it takes some time (10 - 20 seconds) for the deployment to actually complete.

So, when the API update task kicks in, it actually picks up Swagger definitions of the old version of the service and not the freshly deployed ones.

Is there any reasonable way to detect the real completion of the app service deployment process to delay the pipeline until the app has been fully restarted?

By the way, the same happens when restarting an app service manually. Azure happily reports the service has been restarted, but in reality, any requests to the service still return the old state of the app for like 5 seconds, and then it goes down for 5 more seconds, and then it is up and running with the new state. Microsoft should do something about it to stop lying to developers about the state of their apps during restart.

JustAMartin
  • 13,165
  • 18
  • 99
  • 183

1 Answers1

3

We hit a similar sort of issue (timing issues around when an app service slot was really available) so high level we do the following:

  1. Deploy to a slot
  2. Restart the slot
  3. Run a smoke test on the slot until we get a 200

For this we use this smoke test task from the marketplace. You configure it with an endpoint address, an expected success status code plus retries and wait time between tries. Once we get our 200 the pipeline then continues on with next tasks.

I don't think it's relevant to your issue but we do the above to a non-production slot and then do a swap in the pipeline with production after all the above happens. This allows us to warm the non-production slot before the swap.

Matt
  • 12,569
  • 4
  • 44
  • 42