Is it possible to get two builds to checkout on the same directory and how can this be done please?
Currently the two different builds are checking out to two different directories.
You can accomplish this by taking control of the checkout directory locations.
First you need to define your checkout directory to something that can be known to both builds. In your build configuration, browse to Version Control Settings -> Checkout Settings. Change the Checkout Directory setting to Custom Path
. You'll then be prompted to provide the directory to which you want to checkout your source. This can be anywhere you want**, as long as TeamCity has write privileges there.
Next, you need to modify the Checkout Rules (also on Version Control Settings) for each project such that they are targeting a folder relative to the root of the Checkout Directory. You can do this by setting the rule to +:%some.repo.path%=>/%some.sub.folder%
. You could prescribe any subfolder you want there. We just checkout everything to the Checkout Directory root (=>/
).
If both projects are referencing the same Checkout Directory, then this combination of setting should give you the control and flexibility that you're looking for.
** For our Checkout Directory we use the parameterized value %teamcity.agent.work.dir%\%system.teamcity.projectName%\%branch%
. The first two parameters are TeamCity system parameters, and the the last is defined by us. On our system this resolves to G:\BuildAgent\work\$PROJECT\$BRANCH, which keeps everything tidy and predictable.
Seems VCS settings (set of VCS roots and checkout rules) are different for these build configurations, and that's the reason why TeamCity uses different checkout directory. In such circumstances I'd not recommend forcing the server to use the same directory.
Say you have two configurations A and B and you configured TeamCity to build them in the same directory, but A and B have different VCS settings. Then what should be done during checkout?
For instance, when build A finishes on agent and build B starts on the same agent, TeamCity will have to clean all sources under checkout directory and fetch them again. The same story happens when build B starts after build A. As a result these clean checkouts will cause slow downs.
With auto-generated checkout directory, server can optimize checkout performance, and disk usage on agents. Approach with custom checkout directory is not optimal, and is not scalable. Avoid it if possible.
See also: http://confluence.jetbrains.com/display/TCD8/Build+Checkout+Directory http://confluence.jetbrains.com/display/TCD8/Clean+Checkout
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With