0
votes

I am quite new to teamcity and need some help on a dependency configuration. In an unit test method, I have to reference an absolute directory path by calling Directory.SetCurrentDirectory(thePath); this directory contains all the binary package from another library managed by another team. For automated deployment purpose, we created a dedicated folder for this library within our source control (svn) so that whenever we take an upgrade of this library, we just check in the latest change and our automated deployment process will copy the latest library to the production server.

Our current build steps in teamcity copies this library folder into a artifacts folder and I thought I can refer this artifact folder path in my unit test because every check-in the artifact path only differs by increasing a build number and the rest part of the path stays the same. So finding the latest build number is easy through sorting the last modified time of all the builds. But this doesn't work because artifacts wont be created until the teamcity finishes building and running all the tests; hence my test will throw a FileNotFoundException as it was referencing a path which hasn't yet been created.

Can someone explain how to configuration such a dependency? Let me if the question isn't clear.

1

1 Answers

0
votes

One option is to create a second build configuration dependent on successful completion of the initial build process. The artifacts are then available when the second build is triggered (you will set up an artifact dependency and a finish build trigger).

Depending on how your unit tests are actually constructed, you may be able to configure the initial build using a TeamCity variable to refer to the location(s) in the active build working directory (%teamcity.agent.work.dir%, for example). To help out, you can examine the directory structure underneath the buildAgent/work directory.

Reply if any of this is not clear.