Logo

dev-resources.site

for different kinds of informations.

How to: "warm up" an environment using PowerShell and TeamCity

Published at
2/19/2020
Categories
ci
cd
powershell
teamcity
Author
seankilleen
Categories
4 categories in total
ci
open
cd
open
powershell
open
teamcity
open
Author
11 person written this
seankilleen
open
How to: "warm up" an environment using PowerShell and TeamCity

Prior to running some tests on a .NET web application, we wanted to send a request to the environment to “warm it up” – so that the initial start of the application pool would be completed before the tests started running.

Solution

  • Select a URL that you can reasonably expect to hit as a smoke test
  • Create a TeamCity build configuration
  • Add a build step to the configuration of type “Powershell Script”
  • Select an in-line script
  • Add the following powershell:
Invoke-WebRequest -Uri http://theURLToHit -UseDefaultCredentials

Enter fullscreen mode Exit fullscreen mode

Now the build step will hit the URI using the build agent’s credentials, and the command will return when the result does (with a 200 after the app pool has started up).

Happy deployments!

Featured ones: