how to run my build file if I do not checkout files automatically?

Hello there,

This is my first post. I've been searching the community but didn't find any solution yet. I'm surprised nobody had the same question before, which makes me think maybe I'm trying to do something very wrong.

I'm using Perforce, and the only two available options are "Server side checkout", and "not automatically". I'm happy with "not automatically" because I want the build file running in the agent to be the one who get latest revisions from Perforce.

My build file is a NAnt script which resides in Perforce as well, therefore it resides in the agent checkout directory. The problem is that if the Working Directory is clean up automatically by TeamCity - and I realized it happens many times - when a build is triggered because there has been a Perforce change, there won't be any build file in the agent to launch because the folder is empty of course.

I tried to place the build file in a diferent folder than the workout folder, and use a relative path like '..\mybuildscripts\build.xml' becaue according to the documentation TeamCity will run only a build file from a path relative to the checkout directory, but the relative path (..\mybuildscripts\build.xml) turns out into (checkoutfolder\mybuildscripts\build.xml) instead of (checkoutfolder\..\mybuildscripts\build.xml)

I understand that when checking-out files automatically, the checkout folder gets populated automatically and the build file will always exists. But what am I suppose to do when not checking-out files automatically?
I'm migrating from CruiseControl, and used a custom bootstrap plugin to do this, anyone knows the TeamCity way?

Thanks in advance guys.

Comment actions Permalink

I suspect that the statement "according to the documentation TeamCity will run only a build file from a path relative to the checkout directory" is somewhat misleading.  Although the "Path to a build.xml file" parameter does indeed imply this, I invariably specify an absolute path, so that my build file location is totally removed from the checkout directory.

I hope this comment is helpful.

Comment actions Permalink

"Do not checkout files automatically" mode is only required if your build script performs check-in to Perforce at some stage. If not it is recommended to use server side checkout. Otherwise you will have inconsistent state if several builds of this configuration start at the same time (which is quite possible in TeamCity). In this case TeamCity will show some number of changes for a build but in fact because your script is always getting latest revisions the sources will not correspond to the changes shown. I do not think this is what you want.

As for the problem, I think you need to create a so called bootstrap script which only performs checkout and then calls main script to do the rest of the work. Such bootstrap script can be specified right on the NAnt settings page (See "build file content" parameter).


Please sign in to leave a comment.