Ability to run a command/script before VCS checkout happens

Hi,

I was wondering if there was a way to put something on the agent or in one the pre-existing scripts so that before every build that runs on that agent run this command whether it be a .bat or .sh script.  I know you can probably use snapshot dependencies to do this but when you have several hundred builds that you want this one thing to run before vcs check it becomes an issue.  The reason we are having this issue is due to the fact that when some of our builds fail it has an issue shutting down tomcat which was used for integration tests thus when teamcity goes to sync the files to the agent it has an issue due to some process is still holding onto some files thus running into a permission issue.  We want to run some script that will kill these processes before each build so that the builds don't fail right away due to permission issues.  Any help would be great.

Thanks,
Jay

8 comments
Comment actions Permalink

Have you tried to add "Build files cleaner" build feature (i.e. formerly known as Swabra)? This build feature has an option to kill processes locking files in checkout directory.

0
Comment actions Permalink

Is this a plugin I need to install?

0
Comment actions Permalink

It is bundled with TC 6.0, take a look at build steps page in the administration area. There you'll find build features section. Note that detection of locking processes works on Windows agents only.

0
Comment actions Permalink

It can be installed on version 5.1.4 though right?

0
Comment actions Permalink

Jason,

We have 5.1.x plugin build (http://teamcity.jetbrains.com/repository/download/bt203/36530:id/swabra.zip) thought it doesn't contain latest fixes and features.
To install the plugin put swabra.zip to .BuildServer/plugins and restart TeamCity server. Configure cleanup at the runner settings page.

0
Comment actions Permalink

Hi,

Does swabra work if say a build was "stopped"?  I cancelled a running build and it didn't seem to kill some tomcat processes that usually shutdown at the end of a build.  It would have been good to see processes killed before the vcs was applied.  Can someone confirm this only works if the build finishes normally?

Thanks,
Jay

0
Comment actions Permalink

Hello, Jason,

Currently, swabra has an ability to report and kill locking processes only at the build finish regardless of the build status and finish reason (finished itself or was cancelled).
I suppose that you stopped the build before it was actually started.

Reporting or killing locking processes at some other build stages (ex. before applying VCS patch) seems a rare case. Why do you need such reporting?

0
Comment actions Permalink

Hi Victory,

If you say the Swabra plugin works no matter how the build finishes it may suit our needs as a lot of times someone may cancel a build and some targets aren't executed to bring something down.  Then the next build runs into an access denied or permission issue.  I'm hoping Swabra will protect against this.

Thanks,
Jay

0

Please sign in to leave a comment.