I have a .NET 5 Web Api that I deploy using classic pipeline in Azure DevOps.
When my Web Api is published I want to confirm that the correct version was really deployed, sometimes things happen where the deployment is successful but for some reason the older assembly might not be overwritten.
In my Web Api I have a
heartbeat action that returns the version number of the assembly, using the C# syntax
heartbeat action does not require authorization, where the other actions do.
heartbeat action return a JSON response that include the
To set the Web Api build number I followed the steps at Incremental Build Number for .NET Core via Azure DevOps – Edi Wang.
In my Release pipeline, I do the following:
AzureRmWebAppDeployment@4 task to deploy my Api to Azure.
PowerShell@2 task to run a PowerShell script to check that my Api was deployed successfully.
I have a PowerShell script that I store in the code repository called
In the Validate version task I update the properties for
Script Path and
Arguments for my application.
Now when my Web Api is deployed, my PowerShell script runs and confirms that the
versionNumber provided by the
heartbeat action aligns with the
Build.BuildNumber that was generated for the artifact.
Is this really necessary?
The way I look at it though, is it is very little code to ensure the application was deployed correctly before running any further integration or smoke tests, so might save some time and compute.
Thanks for reading!