viernes, 02 de mayo de 2008 16:32
My build process adds IIS Virtual Directories as part of its Drop Build target. Now I would like to know if there is a way to execute a custom cleanup task/program when a build is deleted via the Build Retention Policy. Before everything was cleaned up by hand, but I would like to make is so that the Build Retention Policy automatically cleans up all the extra bits my build makes, but are outside the Drop Location.
Anyone have any suggestions?
(I'm using TFS 2008)
Todas las respuestas
lunes, 05 de mayo de 2008 11:48
There is nothing built in to the product, but here is a suggestion... Write a custom retention policy handler. Here are the basics that you need to know about.
1) make sure to either mark all builds as "retain indefinitely" or remove existing retention policies
2) built a service (web services are the easiest) that runs on the server and listens to the build completion event.
3) the service should query for all builds with the same definition as the one being completed and then figure out which ones if any should be deleted
4) finally, do whatever steps you need to to remove the build.
It's not simple, but its the best way to handle custom actions for retention policies. Hopefully, we will have a better solution to this problem in a future release.
lunes, 05 de mayo de 2008 13:20
Ouch... I can't say it was the answer I was hoping for, but it was the answer I was expecting.
Has anyone else attempted anything like this? Anything I should know about or watch out for? My old build process added a text file that told my cleanup process when the build "expired," but that process was riddled with bugs, most of which were caused by the build process failing early.
As a very helpful TFS extension point, the ability to execute a task when a build is removed would be immensely helpful. Even something pretty basic like the post-build steps built into Visual Studio builds would really help.
lunes, 05 de mayo de 2008 21:20
A less elegant, but maybe easier, approach is to write a simple application/service that polls the build defintion store and keeps track of the existing builds. When you detect that a build that previously existed has been removed, you can perform your clean-up logic. Shouldn't take more than a couple of hours to write this application.
But I would be interested in the first approach though! :-)
jueves, 05 de julio de 2012 18:17Anything new in TFS 2010 that might help with this?