TeamCity Call Url Build Step

亡梦爱人 提交于 2019-12-21 04:05:00

问题


I am using TeamCity to build and deploy files onto a IIS website using Web Deploy 3.

I would like to add a step to call a url when done so that the custom cache can be refreshed when the deployment is finished.

Is there a way I can add a build step to call a url?

Thanks


回答1:


I would solve this using a command line script that hits the url, and one of TeamCity's command line runners.

The question is tagged asp.net so I assume you're on Windows. Put this Get-WebFile script in a Powershell Build Runner. Then call Get-WebFile "http://yourwebapp.net/" at the bottom.




回答2:


An even simpler method would be the same Powershell buildrunner step, but just use:

(New-Object System.Net.WebClient).DownloadString("http://yourwebapp.net");.

No dependencies on other scripts, just native Powershell. Anything wrong with that?




回答3:


A newer, cleaner, just-as-simple method would be also using Powershell:

wget "http://yourwebapp.net"

wget is an alias for Invoke-WebRequest, supporting more options like settings the request timeout.

Full docs: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/invoke-webrequest?view=powershell-6

NB: On older environments you may want to set -UseBasicParsing to prevent parsing errors.



来源:https://stackoverflow.com/questions/14317102/teamcity-call-url-build-step

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!